Drawer API

API documentation for Drawer component

DrawerRoot#

Props#

Defines valid properties in Drawer component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: DrawerRootInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: DrawerRootInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<DrawerRootPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: DrawerRootInstance) => ReactNode)
null
The children to render.
position"top" | "right" | "bottom" | "left" | "full"
left
Position of the drawer.
onOpenChange(event: DrawerRootChangeEvent) => void
null
Callback function that is called when the trigger is clicked.
openboolean
null
Specifies the visibility of the drawer.
defaultOpenboolean
null
Specifies the default visibility of the drawer.
modalboolean
null
Defines if background should be blocked when drawer is displayed.
dismissableboolean
true
Whether clicking outside closes the drawer.
baseZIndexnumber
0
Base zIndex value to use in layering.
autoZIndexboolean
true
Whether to automatically manage layering.
appendToHTMLElement | "body" | "self"
body
A valid query selector or an HTMLElement to specify where the drawer gets attached.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

State#

Defines valid state in Drawer component.

nametypedefaultdescription
openedboolean
null
Whether the drawer is currently opened.

Exposes#

Defines the methods and properties exposed by Drawer component.

nametypedefaultdescription
stateuseDrawerState
null
Current state of the drawer.
maskRefRefObject<{ elementRef: RefObject<HTMLDivElement> }>
null
Reference to the mask element.
rootRefRefObject<{ elementRef: RefObject<HTMLDivElement> }>
null
Reference to the root element.
closeButtonRefRefObject<{ elementRef: RefObject<HTMLButtonElement> }>
null
Reference to the close button element.
onOpenStateChange() => void
null
Method to change the open state of the drawer.
close() => void
null
Method to close the drawer.
onMaskMouseDown(event: MouseEvent) => void
null
Handler for mask mouse down events.
onMaskMouseUp() => void
null
Handler for mask mouse up events.
onMaskEnter() => void
null
Handler for mask enter events.
onEnter() => void
null
Handler for enter events.
onAfterEnter() => void
null
Handler for after enter events.
onLeave() => void
null
Handler for leave events.
onAfterLeave() => void
null
Handler for after leave events.

Interfaces#

Defines passthrough(pt) options of Drawer component.

nametypedefaultdescription
rootDrawerRootPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
backdropDrawerRootPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the backdrop's DOM element.
triggerDrawerRootPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the trigger's DOM element.
portalDrawerRootPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the portal's DOM element.
headerDrawerRootPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the header's DOM element.
titleDrawerRootPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the title's DOM element.
closeDrawerRootPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the close's DOM element.
contentDrawerRootPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the content's DOM element.
footerDrawerRootPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the footer's DOM element.

Types#

Instance of Drawer component.

values
ComponentInstance<DrawerRootProps, DrawerRootState, DrawerRootExposes>

DrawerTrigger#

Props#

Defines valid properties in DrawerTrigger component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: DrawerTriggerInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: DrawerTriggerInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<DrawerTriggerPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: DrawerTriggerInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by DrawerTrigger component.

nametypedefaultdescription
drawerDrawerRootInstance
null
Instance of the Drawer component.

Interfaces#

Defines passthrough(pt) options of DrawerTrigger component.

nametypedefaultdescription
rootDrawerTriggerPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of DrawerTrigger component.

values
ComponentInstance<DrawerTriggerProps, DrawerTriggerState, DrawerTriggerExposes>

DrawerBackdrop#

Props#

Defines valid properties in DrawerBackdrop component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: DrawerBackdropInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: DrawerBackdropInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<DrawerBackdropPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: DrawerBackdropInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by DrawerBackdrop component.

nametypedefaultdescription
drawerDrawerRootInstance
null
The Drawer component instance.

Interfaces#

Defines passthrough(pt) options of DrawerBackdrop component.

nametypedefaultdescription
rootDrawerBackdropPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of DrawerBackdrop component.

values
ComponentInstance<DrawerBackdropProps, DrawerBackdropState, DrawerBackdropExposes>

DrawerPortal#

Props#

Defines valid properties in DrawerPortal component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: DrawerPortalInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: DrawerPortalInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<DrawerPortalPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: DrawerPortalInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by DrawerPortal component.

nametypedefaultdescription
drawerDrawerRootInstance
null
Instance of the Drawer component.

Interfaces#

Defines passthrough(pt) options of DrawerPortal component.

nametypedefaultdescription
rootDrawerPortalPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of DrawerPortal component.

values
ComponentInstance<DrawerPortalProps, DrawerPortalState, DrawerPortalExposes>

DrawerHeader#

Props#

Defines valid properties in DrawerHeader component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: DrawerHeaderInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: DrawerHeaderInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<DrawerHeaderPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: DrawerHeaderInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by DrawerHeader component.

nametypedefaultdescription
drawerDrawerRootInstance
null
The Drawer component instance.

Interfaces#

Defines passthrough(pt) options of DrawerHeader component.

nametypedefaultdescription
rootDrawerHeaderPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of DrawerHeader component.

values
ComponentInstance<DrawerHeaderProps, DrawerHeaderState, DrawerHeaderExposes>

DrawerTitle#

Props#

Defines valid properties in DrawerTitle component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: DrawerTitleInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: DrawerTitleInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<DrawerTitlePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: DrawerTitleInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by DrawerTitle component.

nametypedefaultdescription
drawerDrawerRootInstance
null
The Drawer component instance.

Interfaces#

Defines passthrough(pt) options of DrawerTitle component.

nametypedefaultdescription
rootDrawerTitlePassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of DrawerTitle component.

values
ComponentInstance<DrawerTitleProps, DrawerTitleState, DrawerTitleExposes>

DrawerClose#

Props#

Defines valid properties in DrawerClose component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: DrawerCloseInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: DrawerCloseInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<DrawerClosePassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: DrawerCloseInstance) => ReactNode)
null
The children to render.
iconOnlyboolean
true
Whether to show the DrawerClose with a borderless style.
severitystring & {} | "secondary" | "info" | "success" | "warn" | "danger" | "contrast" | "help"
'secondary'
Severity type of the DrawerClose.
variant"link" | "text" | "outlined"
'text'
Variant of the DrawerClose.
roundedboolean
true
Whether to show the DrawerClose with a rounded style.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by DrawerClose component.

nametypedefaultdescription
drawerDrawerRootInstance
null
Instance of the Drawer component.

Interfaces#

Defines passthrough(pt) options of DrawerClose component.

nametypedefaultdescription
rootDrawerClosePassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of DrawerClose component.

values
ComponentInstance<DrawerCloseProps, DrawerCloseState, DrawerCloseExposes>

DrawerContent#

Props#

Defines valid properties in DrawerContent component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: DrawerContentInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: DrawerContentInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<DrawerContentPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: DrawerContentInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by DrawerContent component.

nametypedefaultdescription
drawerDrawerRootInstance
null
The Drawer component instance.

Interfaces#

Defines passthrough(pt) options of DrawerContent component.

nametypedefaultdescription
rootDrawerContentPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of DrawerContent component.

values
ComponentInstance<DrawerContentProps, DrawerContentState, DrawerContentExposes>

DrawerFooter#

Props#

Defines valid properties in DrawerFooter component.

nametypedefaultdescription
refRef<unknown>
null
The reference to the component instance.
pIfboolean
true
Whether the component should be rendered.
styleCSSProperties | ((instance?: DrawerFooterInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: DrawerFooterInstance) => string)
null
The class name to apply to the component.
asstring | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent<any> | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode, any, any> | ReactPortal | Promise<AwaitedReactNode>
null
The component type to render.
asChildboolean
false
Whether the component should be rendered as a child component.
ptSafeRecord<DrawerFooterPassThrough>
null
The pass-through props to pass to the component
ptOptionsPassThroughOptions
null
The pass-through options to pass to the component
unstyledboolean
null
Whether the component should be rendered without classes.
dtunknown
null
The design token to use for the component.
stylesStylesOptions<ComponentInstance>
null
The styles to use for the component.
childrenReactNode | ((instance: DrawerFooterInstance) => ReactNode)
null
The children to render.
[key: string]any
null
pt-{optionName}-*-
null
Pass through attributes for customizing component. For more info, see Pass Through tab.

Exposes#

Defines the methods and properties exposed by DrawerFooter component.

nametypedefaultdescription
drawerDrawerRootInstance
null
The Drawer component instance.

Interfaces#

Defines passthrough(pt) options of DrawerFooter component.

nametypedefaultdescription
rootDrawerFooterPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.

Types#

Instance of DrawerFooter component.

values
ComponentInstance<DrawerFooterProps, DrawerFooterState, DrawerFooterExposes>

useDrawer#

Props#

Defines valid properties in useDrawer.

nametypedefaultdescription
openboolean
null
Specifies the visibility of the drawer.
defaultOpenboolean
null
Specifies the default visibility of the drawer.
modalboolean
null
Defines if background should be blocked when drawer is displayed.
dismissableboolean
true
Whether clicking outside closes the drawer.
baseZIndexnumber
0
Base zIndex value to use in layering.
autoZIndexboolean
true
Whether to automatically manage layering.
appendToHTMLElement | "body" | "self"
body
A valid query selector or an HTMLElement to specify where the drawer gets attached.
onOpenChange(event: useDrawerChangeEvent) => void
null
Callback function that is called when the trigger is clicked.

State#

Defines valid state in useDrawer.

nametypedefaultdescription
openedboolean
null
Whether the drawer is currently opened.

Exposes#

Defines the methods and properties exposed by useDrawer.

nametypedefaultdescription
stateuseDrawerState
null
Current state of the drawer.
maskRefRefObject<{ elementRef: RefObject<HTMLDivElement> }>
null
Reference to the mask element.
rootRefRefObject<{ elementRef: RefObject<HTMLDivElement> }>
null
Reference to the root element.
closeButtonRefRefObject<{ elementRef: RefObject<HTMLButtonElement> }>
null
Reference to the close button element.
onOpenStateChange() => void
null
Method to change the open state of the drawer.
close() => void
null
Method to close the drawer.
onMaskMouseDown(event: MouseEvent) => void
null
Handler for mask mouse down events.
onMaskMouseUp() => void
null
Handler for mask mouse up events.
onMaskEnter() => void
null
Handler for mask enter events.
onEnter() => void
null
Handler for enter events.
onAfterEnter() => void
null
Handler for after enter events.
onLeave() => void
null
Handler for leave events.
onAfterLeave() => void
null
Handler for after leave events.

Events#

Event fired when the drawer's open state changes.

nametypedescription
valuebooleanThe value of the drawer.

Types#

Instance of useDrawer headless.

values
HeadlessInstance<useDrawerProps, useDrawerState, useDrawerExposes>