Element: <oj-c-collapsible>

CORE PACK

Oracle® JavaScript Extension Toolkit (JET)
21.0.0

G39657-01

Since:
  • 14.0.0
Module:
  • collapsible

Note: This component supersedes the following component: <oj-collapsible>. Migration info available at preceding link.

QuickNav

Attributes


JET Collapsible

Description: A JET Collapsible displays a header that can be expanded to show additional content beneath it. The child element of the oj-c-collapsible in the named header slot is displayed in the header, while the child element in the default slot is displayed as the content.

Note for performance reasons, if the collapsible content is expensive to render, you should wrap it in an oj-defer element to defer the rendering of that content.
See the Collapsible - Deferred Rendering demo for an example.


<oj-c-collapsible>
  <h3 slot='header'>Header 1</h3>
  <p>Content 1</p>
</oj-c-collapsible>

Custom Data Attributes

Collapsible supports the following custom data attributes.

Name Description Example
data-oj-clickthrough

Specify on any element inside the header where you want to control whether Collapsible should toggle disclosure by an event originating from the element or one of its descendants.

For example, if you specify this attribute with a value of "disabled" on a button inside the header, then Collapsible will not trigger disclosure when user clicks on the button.

<oj-c-collapsible>
  <div slot="header">
    <h3>Header 3</h3>
    <oj-c-button data-oj-clickthrough="disabled"></oj-c-button
  </div>
  <p>Content</p>
</oj-c-collapsible>
data-oj-alt-clickthrough

Specify on an element inside the header to control context menu handling for a gesture that originates from the element or one of its descendants.

Set this attribute to enabled to allow a containing JET component context menu when an interactive child would otherwise prevent it. Set it to disabled to prevent containing JET components from opening their context menus for that gesture.

When both values occur between the gesture target and the owning component root, disabled takes precedence over enabled.

The enabled value does not override a context menu owned by a nested JET component.

<oj-c-collapsible>
  <div slot="header">
    <a data-oj-alt-clickthrough="enabled" href="#">Details</a>
  </div>
</oj-c-collapsible>


Usage

Signature:

interface CCollapsibleElement

Typescript Import Format
//To typecheck the element APIs, import as below.
import { CCollapsibleElement } from "oj-c/collapsible";

//For the transpiled javascript to load the element's module, import as below
import "oj-c/collapsible";

For additional information visit:

Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.


Slots

JET components that allow child content support slots. Please see the slots section of the JET component overview doc for more information on allowed slot content and slot types.

Default

The default slot is the content of the collapsible. The oj-c-collapsible element accepts plain text or DOM nodes as children for the default slot.
The header slot is the collapsible's header. If not specified, the header contains only an open/close icon. Note that the header text is required for JET collapsible for accessibility purposes.

Attributes

disabled :boolean

Disables the collapsible if set to true.
Default Value:
  • false
Names
Item Name
Property disabled
Property change event disabledChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-disabled-changed

expanded :boolean

Specifies if the content is expanded.
Default Value:
  • false
Supports writeback:
  • true
Names
Item Name
Property expanded
Property change event expandedChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-expanded-changed

icon-position :"start"|"end"

Controls placement of the icon in the header.
Supported Values:
Value Description
start icon position is start (default, if unspecified)
end icon position is end
Default Value:
  • 'start'
Names
Item Name
Property iconPosition
Property change event iconPositionChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-icon-position-changed

variant :"basic"|"horizontal-rule"

Controls display of the optional divider below the header.
Supported Values:
Value Description
basic basic, no divider (default, if unspecified)
horizontal-rule displays a horizontal divider between the header and content
Default Value:
  • 'basic'
Names
Item Name
Property variant
Property change event variantChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-variant-changed

Events

ojBeforeCollapse

Note: The event detail contains the following properties: oj-c.Collapsible.CollapsibleToggleDetail

Triggered immediately before the collapsible is collapsed.

See Events and Listeners for additional information.

ojBeforeExpand

Note: The event detail contains the following properties: oj-c.Collapsible.CollapsibleToggleDetail

Triggered immediately before the collapsible is expanded.

See Events and Listeners for additional information.

ojCollapse

Note: The event detail contains the following properties: oj-c.Collapsible.CollapsibleToggleDetail

Triggered after the collapsible has been collapsed.

See Events and Listeners for additional information.

ojExpand

Note: The event detail contains the following properties: oj-c.Collapsible.CollapsibleToggleDetail

Triggered after the collapsible has been expanded (after animation completes).

See Events and Listeners for additional information.

Methods

getProperty(property) : {any}

Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description
property string The property name to get. Supports dot notation for subproperty access.
Returns:
Type
any

setProperties(properties) : {void}

Performs a batch set of properties.
Parameters:
Name Type Description
properties object An object containing the property and value pairs to set.
Returns:
Type
void

setProperty(property, value) : {void}

Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a corresponding event.
Parameters:
Name Type Description
property string The property name to set. Supports dot notation for subproperty access.
value any The new value to set the property to.
Returns:
Type
void

Type Definitions

Documentation-only Types

Note: Type definitions in this section have been provided for documentation purposes and cannot be imported into application code.

CollapsibleToggleDetail

Properties:
Name Type Description
accept (acceptPromise:Promise<void>) => void This method can be called with an application-created Promise to cancel this event asynchronously. The Promise should be resolved or rejected to accept or cancel the event, respectively.
target EventTarget | null