Drawer API

API documentation for Drawer component

Drawer#

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?: DrawerInstance) => CSSProperties)
null
The style to apply to the component.
classNamestring | ((instance?: DrawerInstance) => 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<DrawerPassThrough>
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: DrawerInstance) => ReactNode)
null
The children to render.
position"top" | "bottom" | "left" | "right" | "full"
left
Position of the drawer.
onOpenChange(event: DrawerChangeEvent) => void
null
Callback function that is called when the trigger is clicked.
openboolean
false
Specifies the visibility of the drawer.
defaultOpenboolean
false
Specifies the default visibility of the drawer.
modalboolean
undefined
Defines if background should be blocked when drawer is displayed.
dismissableboolean
true
Whether clicking outside closes the drawer.
blockScrollboolean
false
Whether background scroll should be blocked when drawer is visible.
baseZIndexnumber
0
Base zIndex value to use in layering.
autoZIndexboolean
true
Whether to automatically manage layering.
[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.
maskVisibleboolean
null
Whether the mask is currently visible.

Exposes#

Defines the methods and properties exposed by Drawer component.

nametypedefaultdescription
stateuseDrawerState
null
Current state of the drawer.
maskRefRefObject<HTMLDivElement>
null
Reference to the mask element.
motionRefRefObject<{ elementRef: RefObject<HTMLDivElement> }>
null
Reference to the motion 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.
onMotionEnter() => void
null
Handler for motion enter events.
onMotionAfterEnter() => void
null
Handler for motion after enter events.
onMotionBeforeLeave() => void
null
Handler for motion before leave events.
onMotionAfterLeave() => void
null
Handler for motion after leave events.

Interfaces#

Defines passthrough(pt) options of Drawer component.

nametypedefaultdescription
rootDrawerPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the root's DOM element.
maskDrawerPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the mask's DOM element.
triggerDrawerPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the trigger's DOM element.
triggerIconDrawerPassThroughType<HTMLAttributes<HTMLElement>>
null
Used to pass attributes to the trigger icon's DOM element.
portalDrawerPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the portal's DOM element.
headerDrawerPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the header's DOM element.
titleDrawerPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the title's DOM element.
closeDrawerPassThroughType<HTMLAttributes<HTMLButtonElement>>
null
Used to pass attributes to the close's DOM element.
closeIconDrawerPassThroughType<HTMLAttributes<HTMLElement>>
null
Used to pass attributes to the close icon's DOM element.
contentDrawerPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the content's DOM element.
footerDrawerPassThroughType<HTMLAttributes<HTMLDivElement>>
null
Used to pass attributes to the footer's DOM element.

Types#

Instance of Drawer component.

values
ComponentInstance<DrawerProps, DrawerState, DrawerExposes>

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
drawerDrawerInstance
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>

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
drawerDrawerInstance
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
drawerDrawerInstance
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
drawerDrawerInstance
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
drawerDrawerInstance
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
drawerDrawerInstance
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
drawerDrawerInstance
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
false
Specifies the visibility of the drawer.
defaultOpenboolean
false
Specifies the default visibility of the drawer.
modalboolean
undefined
Defines if background should be blocked when drawer is displayed.
dismissableboolean
true
Whether clicking outside closes the drawer.
blockScrollboolean
false
Whether background scroll should be blocked when drawer is visible.
baseZIndexnumber
0
Base zIndex value to use in layering.
autoZIndexboolean
true
Whether to automatically manage layering.
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.
maskVisibleboolean
null
Whether the mask is currently visible.

Exposes#

Defines the methods and properties exposed by useDrawer.

nametypedefaultdescription
stateuseDrawerState
null
Current state of the drawer.
maskRefRefObject<HTMLDivElement>
null
Reference to the mask element.
motionRefRefObject<{ elementRef: RefObject<HTMLDivElement> }>
null
Reference to the motion 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.
onMotionEnter() => void
null
Handler for motion enter events.
onMotionAfterEnter() => void
null
Handler for motion after enter events.
onMotionBeforeLeave() => void
null
Handler for motion before leave events.
onMotionAfterLeave() => void
null
Handler for motion 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>