headless

API collapse

CollapseApi

interface

Interface representing the API for a collapsible component.

Methods
close

close(): void

Triggers collapse closing programmatically.

Returns

void


open

open(): void

Triggers the collapse content to be displayed for the user.

Returns

void


toggle

toggle(): void

Toggles the collapse content visibility.

Returns

void


CollapseDirectives

interface

Interface representing the directives used in a collapse component.

Properties
collapseDirective

collapseDirective: Directive

Directive to apply the collapse.


triggerDirective

triggerDirective: Directive

Directive to apply to a trigger;


CollapseProps

interface

Properties for the Collapse component.

Properties
animated

animated: boolean

If true, collapse closing and opening will be animated.

Default Value

true


animatedOnInit

animatedOnInit: boolean

If true, collapse opening will be animated at init time.

Default Value

false


id

id: string

id of the collapse

Default Value

''


onHidden

onHidden: () => void

Callback called when the collapse is hidden.

Returns

void

Default Value
() => {}

onShown

onShown: () => void

Callback called when the collapse is shown.

Returns

void

Default Value
() => {}

onVisibleChange

onVisibleChange: (visible) => void

Callback called when the collapse visibility changed.

Parameters
visible

boolean

The new visibility state of the collapse.

Returns

void

Default Value
() => {}

transition

transition: TransitionFn

The transition function will be executed when the collapse is displayed or hidden.

Depending on the value of animatedOnInit, the animation can be optionally skipped during the showing process.

Default Value

() => {}


visible

visible: boolean

If true the collapse is visible to the user

Default Value

true


CollapseState

interface

Represents the state of a Collapse component.

Properties
hidden

hidden: boolean

Is true when the collapse is hidden. Compared to visible, this is updated after the transition is executed.


visible

visible: boolean

If true the collapse is visible to the user

Default Value

true


CollapseWidget

type alias

CollapseWidget = Widget<CollapseProps, CollapseState, CollapseApi, CollapseDirectives>

Represents a widget for handling collapse functionality.

This type defines the structure of a CollapseWidget, which includes properties, state, API, and directives necessary for managing the collapse behavior in the UI.


createCollapse

constant

const createCollapse: WidgetFactory<CollapseWidget>

Create an CollapseWidget factory

Param

the transition function that will be used for the collapse

Returns

an CollapseWidget


getCollapseDefaultConfig

function

getCollapseDefaultConfig(): CollapseProps

Retrieve a shallow copy of the default collapse config

Returns

CollapseProps

the default collapse config