Element: <oj-c-collapsible>

CORE PACK

Oracle® JavaScript Extension Toolkit (JET)
16.1.0

F92237-01

Since:
  • 14.0.0
Module:
  • collapsible

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>


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.
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.
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 :"end"|"start"

Controls placement of the icon in the header.
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.
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

Triggered immediately before the collapsible is collapsed.
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
accept (param: 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

ojBeforeExpand

Triggered immediately before the collapsible is expanded.
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
accept (param: 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

ojCollapse

Triggered after the collapsible has been collapsed.
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type
target EventTarget | null

ojExpand

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

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type
target EventTarget | null

Methods

getProperty(property) : {any}

Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description
property 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 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 The property name to set. Supports dot notation for subproperty access.
value The new value to set the property to.
Returns:
Type
void