Bootstrap

API drawer

createDrawer

constant

const createDrawer: WidgetFactory<DrawerWidget>

Create a Drawer with given config props

Param

an optional Drawer config

Returns

a DrawerWidget


DefaultDrawerSlotStructure

function

DefaultDrawerSlotStructure(slotContext): Element

Renders the default slot structure for a Drawer component.

Parameters
slotContext

DrawerContext

The context containing the state and properties for the Drawer component.

Returns

Element

The JSX element representing the default slot structure of the Drawer.


Drawer

function

Drawer(props): Element

Drawer component that integrates with a widget context and renders a slot structure.

Parameters
props

Partial<DrawerProps> & object

The properties for the Drawer component.

Returns

Element

The rendered Drawer component.

The Drawer component uses the useWidget hook to create a widget context with the provided configuration. It renders the slot content using the Slot component.


DrawerApi

interface

Interface representing the API for a Drawer component.

Properties
close

close: () => void

Trigger the closing of the drawer.

Returns

void


open

open: () => void

Trigger the opening of the drawer.

Returns

void


DrawerContext

type alias

DrawerContext = WidgetSlotContext<DrawerWidget>

Represents the context for a Drawer widget. This interface is an alias for WidgetSlotContext<DrawerWidget>.


DrawerDirectives

interface

Represents the directives for the Drawer component.

Properties
backdropDirective

backdropDirective: Directive

Directive to put on the backdrop DOM element.


backdropPortalDirective

backdropPortalDirective: Directive

Portal directive to put on the backdrop DOM element.


containerDirective

containerDirective: Directive

Directive to put on the container DOM element in order for the drawer to size correctly.


drawerDirective

drawerDirective: Directive

Directive to put on the drawer DOM element.


drawerPortalDirective

drawerPortalDirective: Directive

Portal directive to put on the drawer DOM element.


splitterDirective

splitterDirective: Directive

Directive to put on the splitter DOM element.


DrawerPositions

type alias

DrawerPositions = "inline-start" | "inline-end" | "block-start" | "block-end"

Possible values for the drawer positions


DrawerProps

interface

Represents the properties for the Drawer component.

Properties
animated

animated: boolean

If true opening and closing will be animated.

Default Value

true


ariaDescribedBy

ariaDescribedBy: string

aria-describedby attribute to use for the drawer element.

Default Value

''


ariaLabelledBy

ariaLabelledBy: string

aria-labelledby attribute to use for the drawer element.

Default Value

''


backdrop

backdrop: boolean

If true displays the backdrop element and disables the body scrolling, otherwise the body of the document is navigable

Default Value

true


backdropClass

backdropClass: string

Classes to add on the backdrop DOM element.

Default Value

''


backdropTransition

backdropTransition: TransitionFn

The transition to use for the backdrop behind the drawer (if present).

Default Value

fadeTransition


bodyScroll

bodyScroll: boolean

If true allows body scrolling when the drawer is open.

Default Value

false


children

children: SlotContent<DrawerContext>

Template for the drawer body


className

className: string

CSS classes to be applied on the widget main container

Default Value

'w-full'


container

container: HTMLElement | null

Which element should contain the drawer and backdrop DOM elements. If it is not null, the drawer and backdrop DOM elements are moved to the specified container. Otherwise, they stay where the widget is located.

Default Value
typeof window !== 'undefined' ? document.body : null

focusOnInit

focusOnInit: boolean

If true focuses the drawer when it is opened.

Default Value

true


header

header: SlotContent<DrawerContext>

Template for the drawer header


onHidden

onHidden: () => void

Event to be triggered when the transition is completed and the drawer is not visible.

Returns

void

Default Value
() => {}

onMaximizedChange

onMaximizedChange: (isMaximized) => void

Event to be triggered when the maximized state changes.

Parameters
isMaximized

boolean

Returns

void

Default Value
() => {}

onMinimizedChange

onMinimizedChange: (isMinimized) => void

Event to be triggered when the minimized state changes.

Parameters
isMinimized

boolean

Returns

void

Default Value
() => {}

onResizingChange

onResizingChange: (isResizing) => void

Event to be triggered when the user starts or stops resizing the drawer.

Parameters
isResizing

boolean

Returns

void

Default Value
() => {}

onShown

onShown: () => void

Event to be triggered when the transition is completed and the drawer is visible.

Returns

void

Default Value
() => {}

onSizeChange

onSizeChange: (size) => void

An event emitted when the drawer size changes (width or height depending on the orientation).

Event payload is equal to the newly selected width or height.

Parameters
size

number | null

Returns

void

Default Value
() => {}

onVisibleChange

onVisibleChange: (visible) => void

Event to be triggered when the visible property changes.

Parameters
visible

boolean

new value of the visible propery

Returns

void

Default Value
() => {}

resizable

resizable: boolean

If true, the drawer can be resized by the user.

Default Value

false


size

size: number | null

Size of the drawer in pixel once the user start interacting. It corresponds to the height or the width depending on the drawer orientation

Default Value

null


structure

structure: SlotContent<DrawerContext>

Global template for the drawer component


transition

transition: TransitionFn

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

Default Value
collapseHorizontalTransition

verticalTransition

verticalTransition: TransitionFn

The transition function for vertically positioned drawer (top, bottom) that will be executed when the drawer is displayed or hidden.

Default Value
collapseVerticalTransition

visible

visible: boolean

If true, the drawer is shown; otherwise, it is hidden.

Default Value

false


DrawerState

interface

Represents the state of a Drawer component.

Properties
backdropClass

backdropClass: string

Classes to add on the backdrop DOM element.

Default Value

''


backdropHidden

backdropHidden: boolean

Whether the backdrop is fully hidden. This can be true either because backdrop is false or because visible is false and there is no current transition.


children

children: SlotContent<DrawerContext>

Template for the drawer body


className

className: string

CSS classes to be applied on the widget main container

Default Value

'w-full'


container

container: HTMLElement | null

Which element should contain the drawer and backdrop DOM elements. If it is not null, the drawer and backdrop DOM elements are moved to the specified container. Otherwise, they stay where the widget is located.

Default Value
typeof window !== 'undefined' ? document.body : null

header

header: SlotContent<DrawerContext>

Template for the drawer header


hidden

hidden: boolean

Flag to show whether the drawer is fully hidden.


isVertical

isVertical: boolean

Flag to show whether the drawer is vertically positioned.


resizable

resizable: boolean

If true, the drawer can be resized by the user.

Default Value

false


size

size: number | null

Size of the drawer in pixel once the user start interacting. It corresponds to the height or the width depending on the drawer orientation

Default Value

null


structure

structure: SlotContent<DrawerContext>

Global template for the drawer component


visible

visible: boolean

If true, the drawer is shown; otherwise, it is hidden.

Default Value

false


DrawerWidget

type alias

DrawerWidget = Widget<DrawerProps, DrawerState, DrawerApi, DrawerDirectives>

Represents a Drawer widget component.


getDrawerDefaultConfig

constant

const getDrawerDefaultConfig: () => DrawerProps

Retrieve a shallow copy of the default Drawer config

Returns

DrawerProps

the default Drawer config