Bootstrap

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


CollapseDirective

class

Directive to control the collapse behavior of an element.

Properties
animated

animated: undefined | boolean

If true, collapse closing and opening will be animated.

Default Value

true


animatedOnInit

animatedOnInit: undefined | boolean

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

Default Value

false


className

className: undefined | string

CSS classes to be applied on the widget main container

Default Value

''


hidden

hidden: EventEmitter<void>

Callback called when the collapse is hidden.

Default Value
() => {}

horizontal

horizontal: undefined | boolean

If true, collapse will be done horizontally.

Default Value

false


id

id: undefined | string

id of the collapse

Default Value

''


shown

shown: EventEmitter<void>

Callback called when the collapse is shown.

Default Value
() => {}

visible

visible: undefined | boolean

If true the collapse is visible to the user

Default Value

true


visibleChange

visibleChange: EventEmitter<boolean>

Callback called when the collapse visibility changed.

Default Value
() => {}
Accessors
api

get api(): W["api"]

Retrieves the widget api

Returns

W["api"]

the widget api


directives

get directives(): W["directives"]

Retrieves the widget directives

Returns

W["directives"]

the widget directives


state

get state(): AngularState<W>

Retrieves the widget state as an Angular Signal

Returns

AngularState<W>

the widget state


CollapseDirectives

interface

Interface representing the directives used in a collapse component.

Properties
collapseDirective

collapseDirective: Directive

Directive to apply the collapse.


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


className

className: string

CSS classes to be applied on the widget main container

Default Value

''


horizontal

horizontal: boolean

If true, collapse will be done horizontally.

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
() => {}

visible

visible: boolean

If true the collapse is visible to the user

Default Value

true


CollapseState

interface

Represents the state of a collapse component. Extends the properties and state from CollapseCommonPropsAndState.

Properties
className

className: string

CSS classes to be applied on the widget main container

Default Value

''


hidden

hidden: boolean

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


horizontal

horizontal: boolean

If true, collapse will be done horizontally.

Default Value

false


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

function

createCollapse(config?): CollapseWidget

Create an CollapseWidget with given config props

Parameters

config?: PropsConfig<CollapseProps>

an optional collapse config

Returns

CollapseWidget

an CollapseWidget


getCollapseDefaultConfig

function

getCollapseDefaultConfig(): CollapseProps

Retrieve a shallow copy of the default collapse config

Returns

CollapseProps

the default collapse config