Drawer
A side or bottom panel (Fluent UI v2 style): by default an overlay, modal unless it is non-modal, rendered in a portal (inheriting the WaveProvider theme) while open; with type="inline" a panel in the page layout, rendered in place. With unmountOnClose={false} either kind stays mounted while closed, hidden and inert.
- **Opening**: controlled (open), or uncontrolled with a Drawer.Trigger placed directly inside the Drawer or in a Fragment there (it renders in place, outside the panel); the trigger opens and closes it.
- **Modal**: focus moves into the panel and Tab stays inside it (toasts included), the rest of the page is inert (instead of aria-modal), and the page does not scroll. modalType="alert" renders role="alertdialog", and a backdrop press does not close it.
- **Non-modal**: modalType="non-modal" leaves the page usable (no backdrop, no focus trap, nothing inert, the page scrolls). Focus moves in on open; Tab and Shift+Tab leave the panel in the page's order right after the element that opened it; Escape closes it only while focus is inside it; presses on the page never close it; focus returns to the opener only from inside. Reserve the panel's room in the page layout while it is open, so it hides no page control.
- **Inline**: type="inline" renders the panel where the Drawer is, after its direct triggers, as an <aside> (a complementary landmark named by its title), also in the server HTML. It is page content: no portal, backdrop, focus trap, inert page or scroll lock, and toasts keep their corner next to it. Its trigger toggles it (with aria-expanded and aria-controls, no aria-haspopup); opening it moves no focus; Escape and presses outside never close it; closing it returns focus only when focus was inside. position picks its inner edge and size its width (its height at the bottom); separator draws the inner edge. Place it in your layout, for example a flex row of the panel and the page content. Changing type remounts the panel and its content.
- **Closing**: Escape (only the topmost layer: a popup opened inside closes first), a click on the backdrop (a drag that starts inside does not close it), the Close button and Drawer.Close (an inline drawer: the trigger, the Close button and Drawer.Close). onOpenChange gets the reason as its second argument (details.reason), so a controlled drawer can refuse some of them. A backdrop press blurs the focused field before the drawer closes, so a typed value is committed as with the Close button; when a controlled drawer refuses the press, the field gets focus back. Focus returns to the first of these that can take focus: finalFocusRef, the element that had focus when the drawer opened, the trigger, an element next to where that opener was.
- **Size and position**: position is end (default) or start, which follow the text direction, left or right, or bottom (along the bottom edge, the window wide). size sets the width at a side and the height at the bottom: small (default, 320px), medium (592px), large (940px) or full; the panel never grows past the window (an inline one past its container). A width class in className (a height class for bottom) replaces the size. An overlay panel pads the safe-area insets of the screen edges it touches (the iOS home indicator, once the page sets viewport-fit=cover). Both render as data-position and data-size, next to data-type.
- **Layout**: the title prop and the built-in Close button make the header row; a Drawer.Header replaces it, with a Drawer.HeaderNavigation row (a Back button, commands) and a Drawer.HeaderTitle (the heading, an action area and the Close button). The rest of the content scrolls in the body (Drawer.Body gives it your props); a Drawer.Footer is an action row below the body that never scrolls. Make the parts direct children of the Drawer (a Fragment there is fine). The header draws a line under itself once the body is scrolled, the footer one above itself while content continues below: the body, the header and the footer render the body's scroll state as data-scroll-state (none, top, middle, bottom).
- **Backdrop, Close button and title actions**: the backdrop is the panel's sibling and a slot (backdrop: null removes it, appearance picks dimmed or transparent); a modal opened over another modal dims the page once. closeButton sets the content of every built-in Close button, or hides them (null); a button passed there is merged into it. titleAction places header buttons between the title heading and the Close button.
- **Kept mounted**: unmountOnClose={false} keeps the panel and its content mounted while the drawer is closed, so a form keeps what was typed and the components inside keep their state; each open of an overlay focuses the first focusable element again (an autoFocus inside never applies), and a kept overlay opened while another overlay is open stacks above it. A kept inline drawer is in the server HTML, hidden.
- **Motion**: an overlay panel slides in from its edge and fades in, and slides back and fades out, over 250 ms (small), 300 ms (medium), 400 ms (large) or 500 ms (full), and its backdrop fades with it; an overlay open by default animates in when it mounts in the browser. An inline drawer opens and closes the space it takes in the layout over the same durations, its panel held at its size and fading, so it reads as sliding out from its edge; one open by default does not animate in, and one at full has no motion (a percentage width in className resizes oddly during the motion: give it a length, or pass motion={null}). Under reduced motion every drawer appears and disappears at once. motion (the panel, or an inline drawer's space) and backdropMotion (the backdrop) turn each off (null) or replace it, and WaveProvider motion="none" turns both defaults off. className is a plain class list: data-[presence=…]: classes there apply next to the default motion.
- **Presence**: the panel and the backdrop mount through the presence core and render data-presence (entering and exiting while the drawer's motion runs, entered while open, exited while kept closed). An inline drawer's <aside> is the only child of an element of its own (wave-drawer__collapse), which renders the same phases, carries the inline motion and has no box while open, so the <aside> lays out in your page as without it. The backdrop and the panel (an inline drawer's <aside> and the element around it) are inert while exiting and hidden and inert while kept closed. A closed drawer waits for its motion (the panel's, an inline one's on the element around it) before it unmounts or hides, while focus, the trap, the isolation and the scroll lock follow the open state at once: an exiting overlay lets clicks through to the page (an inert element takes no pointer events). Opened again during its exit, the same panel enters again.
The sub-components are also exported under flat names (DrawerTrigger, DrawerClose, DrawerTitle, DrawerHeader, DrawerHeaderTitle, DrawerHeaderNavigation, DrawerBody, DrawerFooter) for React Server Components, which cannot use the dotted form; dotted access (Drawer.Trigger) needs a client file.
Examples
Default
export const Default: Story = {
render: renderWithTrigger,
};Start Position
export const StartPosition: Story = {
args: { position: 'start', title: 'Navigation' },
render: renderWithTrigger,
};Sizes
export const Sizes: Story = {
render: function SizesDrawers({ children, size: _size, title: _title, ...args }) {
return (
<div className="flex flex-wrap gap-2">
{sizes.map((size) => (
<Drawer key={size} {...args} size={size} title={`A ${size} drawer`}>
<Drawer.Trigger>
<Button>{`Open ${size}`}</Button>
</Drawer.Trigger>
<p>{children}</p>
</Drawer>
))}
</div>
);
},
};Bottom Position
export const BottomPosition: Story = {
args: { position: 'bottom', size: 'medium', title: 'Details' },
render: renderWithTrigger,
};Header And Footer
This example opens a dialog or panel. Use the button to show it.
export const HeaderAndFooter: Story = {
args: { defaultOpen: true },
parameters: openStoryParameters,
render: function HeaderAndFooterDrawer({ children, title: _title, ...args }) {
return (
<Drawer {...args}>
<Drawer.Trigger>
<Button appearance="primary">Open drawer</Button>
</Drawer.Trigger>
<Drawer.Header>
<Drawer.HeaderTitle
action={
<Button appearance="subtle" size="small" icon={<ExpandIcon />} aria-label="Expand" />
}
>
Filters
</Drawer.HeaderTitle>
</Drawer.Header>
<p>{children}</p>
<Drawer.Footer>
<Drawer.Close>
<Button appearance="primary">Apply</Button>
</Drawer.Close>
<Button>Reset</Button>
</Drawer.Footer>
</Drawer>
);
},
};Long Content
export const LongContent: Story = {
args: { title: 'All filters' },
render: function LongContentDrawer({ children: _children, ...args }) {
return (
<Drawer {...args}>
<Drawer.Trigger>
<Button appearance="primary">Open all filters</Button>
</Drawer.Trigger>
<div className="flex flex-col gap-3">
{longFields.map((field) => (
<Field key={field} label={field}>
<Input />
</Field>
))}
</div>
<Drawer.Footer>
<Drawer.Close>
<Button appearance="primary">Apply</Button>
</Drawer.Close>
<Button>Reset</Button>
</Drawer.Footer>
</Drawer>
);
},
};Form In Drawer
Nothing saved yet.
export const FormInDrawer: Story = {
render: function FormInDrawerDrawer({ children: _children, title: _title, ...args }) {
const formId = React.useId();
const [open, setOpen] = React.useState(false);
const [saved, setSaved] = React.useState('');
const handleOpenChange: NonNullable<DrawerProps['onOpenChange']> = (next, details) => {
setOpen(next);
args.onOpenChange?.(next, details);
};
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
const name = new FormData(event.currentTarget).get('displayName');
setSaved(typeof name === 'string' ? name : '');
handleOpenChange(false, { reason: 'close', event: event.nativeEvent });
};
return (
<div className="flex flex-col items-start gap-2">
{/* The story owns the controlled pair; every other arg is forwarded. */}
<Drawer {...args} open={open} onOpenChange={handleOpenChange}>
<Drawer.Trigger>
<Button appearance="primary">Edit profile</Button>
</Drawer.Trigger>
<Drawer.Header>
<Drawer.HeaderTitle>Profile</Drawer.HeaderTitle>
</Drawer.Header>
<form
id={formId}
aria-label="Profile"
className="flex flex-col gap-3"
onSubmit={handleSubmit}
>
<Field label="Display name">
<Input name="displayName" defaultValue={saved} />
</Field>
<Field label="Email">
<Input name="email" type="email" />
</Field>
</form>
<Drawer.Footer>
<Button appearance="primary" type="submit" form={formId}>
Save
</Button>
<Drawer.Close>
<Button>Cancel</Button>
</Drawer.Close>
</Drawer.Footer>
</Drawer>
<p>{saved ? `Saved as ${saved}.` : 'Nothing saved yet.'}</p>
</div>
);
},
};Multiple Levels
export const MultipleLevels: Story = {
render: function MultipleLevelsDrawer({ children: _children, title: _title, ...args }) {
const [level, setLevel] = React.useState<SettingsLevel>('settings');
const backRef = React.useRef<HTMLButtonElement>(null);
const itemRefs = React.useRef<Partial<Record<SettingsLevel, HTMLButtonElement | null>>>({});
// Set by a level change from inside the drawer; the layout effect then moves focus in the same
// commit, since the element that had it (the item, or Back) is gone.
const returnToRef = React.useRef<SettingsLevel | null>(null);
React.useLayoutEffect(() => {
const returnTo = returnToRef.current;
if (returnTo === null) return;
returnToRef.current = null;
if (level === 'settings') itemRefs.current[returnTo]?.focus();
else backRef.current?.focus();
}, [level]);
const openLevel = (next: SettingsLevel) => {
returnToRef.current = level === 'settings' ? next : level;
setLevel(next);
};
const handleOpenChange: NonNullable<DrawerProps['onOpenChange']> = (next, details) => {
if (!next) setLevel('settings');
args.onOpenChange?.(next, details);
};
return (
<Drawer {...args} onOpenChange={handleOpenChange}>
<Drawer.Trigger>
<Button appearance="primary">Open settings</Button>
</Drawer.Trigger>
<Drawer.Header>
{level !== 'settings' && (
<Drawer.HeaderNavigation aria-label="Settings levels">
<Button
ref={backRef}
appearance="subtle"
icon={<BackIcon />}
onClick={() => openLevel('settings')}
>
Back
</Button>
</Drawer.HeaderNavigation>
)}
<Drawer.HeaderTitle>{levelTitles[level]}</Drawer.HeaderTitle>
</Drawer.Header>
{level === 'settings' ? (
<div className="flex flex-col items-start gap-2">
{(['notifications', 'privacy'] as const).map((item) => (
<Button
key={item}
ref={(node) => {
itemRefs.current[item] = node;
}}
appearance="subtle"
onClick={() => openLevel(item)}
>
{levelTitles[item]}
</Button>
))}
</div>
) : level === 'notifications' ? (
<div className="flex flex-col gap-3">
<Switch label="Email notifications" defaultChecked />
<Switch label="Push notifications" />
</div>
) : (
<div className="flex flex-col gap-3">
<Switch label="Show my status" defaultChecked />
<Switch label="Share usage data" />
</div>
)}
</Drawer>
);
},
};Scrollable Text Body
export const ScrollableTextBody: Story = {
args: { title: 'Terms of service' },
render: function ScrollableTextBodyDrawer({ children: _children, ...args }) {
return (
<Drawer {...args}>
<Drawer.Trigger>
<Button appearance="primary">Read the terms</Button>
</Drawer.Trigger>
<Drawer.Body tabIndex={0} role="region" aria-label="Terms text">
<div className="flex flex-col gap-3">
{termsParagraphs.map((paragraph) => (
<p key={paragraph}>{paragraph}</p>
))}
</div>
</Drawer.Body>
<Drawer.Footer>
<Drawer.Close>
<Button appearance="primary">Accept</Button>
</Drawer.Close>
</Drawer.Footer>
</Drawer>
);
},
};Trigger With Tooltip
export const TriggerWithTooltip: Story = {
render: function TriggerWithTooltipDrawer({ children, ...args }) {
return (
<Drawer {...args}>
<Drawer.Trigger>
{(triggerProps) => (
<Tooltip content="Narrow the list">
<Button appearance="primary" {...triggerProps}>
Open drawer
</Button>
</Tooltip>
)}
</Drawer.Trigger>
<p>{children}</p>
</Drawer>
);
},
};Controlled
export const Controlled: Story = {
args: { position: 'start', title: 'Start drawer' },
render: function ControlledDrawer({ children, ...args }) {
const [open, setOpen] = React.useState(false);
const handleOpenChange: NonNullable<DrawerProps['onOpenChange']> = (next, details) => {
setOpen(next);
args.onOpenChange?.(next, details);
};
return (
<>
<Button
appearance="primary"
onClick={(event) =>
handleOpenChange(true, { reason: 'trigger', event: event.nativeEvent })
}
>
Open
</Button>
{/* The story owns the controlled pair; every other arg is forwarded. */}
<Drawer {...args} open={open} onOpenChange={handleOpenChange}>
<p>{children}</p>
<Drawer.Footer>
<Button
appearance="primary"
onClick={(event) =>
handleOpenChange(false, { reason: 'close', event: event.nativeEvent })
}
>
Done
</Button>
</Drawer.Footer>
</Drawer>
</>
);
},
};Non Modal
This example opens a dialog or panel. Use the button to show it.
export const NonModal: Story = {
args: {
modalType: 'non-modal',
title: 'Order 1042',
children: 'Two items, shipped on Monday to the warehouse in Lyon.',
},
render: function NonModalDrawer({ children, ...args }) {
const [open, setOpen] = React.useState(true);
const handleOpenChange: NonNullable<DrawerProps['onOpenChange']> = (next, details) => {
setOpen(next);
args.onOpenChange?.(next, details);
};
return (
<div className={open ? 'pe-80' : undefined}>
<div className="flex flex-col gap-3">
<p>Orders received this week. Open an order's details while you keep working.</p>
<div className="flex flex-wrap gap-2">
{/* The story owns the controlled pair; every other arg is forwarded. */}
<Drawer {...args} open={open} onOpenChange={handleOpenChange}>
<Drawer.Trigger>
<Button appearance="primary">Order details</Button>
</Drawer.Trigger>
<p>{children}</p>
<Drawer.Footer>
<Button>Print label</Button>
<Drawer.Close>
<Button appearance="primary">Done</Button>
</Drawer.Close>
</Drawer.Footer>
</Drawer>
<Button>Refresh</Button>
</div>
<Field label="Search orders">
<Input />
</Field>
</div>
</div>
);
},
parameters: openStoryParameters,
};Alert Drawer
export const AlertDrawer: Story = {
args: {
modalType: 'alert',
title: 'Discard the draft?',
children: 'The draft and its attachments are deleted. This cannot be undone.',
},
render: ({ children, ...args }) => (
<Drawer {...args}>
<Drawer.Trigger>
<Button>Discard draft</Button>
</Drawer.Trigger>
<p>{children}</p>
<Drawer.Footer>
<Drawer.Close>
<Button appearance="subtle">Keep editing</Button>
</Drawer.Close>
<Drawer.Close>
<Button appearance="primary">Discard</Button>
</Drawer.Close>
</Drawer.Footer>
</Drawer>
),
};Keep Mounted
export const KeepMounted: Story = {
args: {
unmountOnClose: false,
title: 'Search filters',
children: 'The filters stay as you left them when the drawer opens again.',
},
render: ({ children, ...args }) => (
<Drawer {...args}>
<Drawer.Trigger>
<Button appearance="primary">Open filters</Button>
</Drawer.Trigger>
<div className="flex flex-col gap-3">
<p>{children}</p>
<Field label="Keyword">
<Input />
</Field>
<Field label="Author">
<Input />
</Field>
<Switch label="Only available items" />
</div>
<Drawer.Footer>
<Drawer.Close>
<Button appearance="primary">Done</Button>
</Drawer.Close>
</Drawer.Footer>
</Drawer>
),
};Inline
Orders received this week. The details pane stays open while you work.
export const Inline: Story = {
args: {
type: 'inline',
separator: true,
defaultOpen: true,
title: 'Order 1042',
children: 'Two items, shipped on Monday to the warehouse in Lyon.',
},
render: function InlineDrawer({ children, ...args }) {
return (
<div className="flex h-96 rounded-md border border-wave-border">
<div className="flex min-w-0 flex-1 flex-col gap-3 p-4">
<p>Orders received this week. The details pane stays open while you work.</p>
<Field label="Search orders">
<Input />
</Field>
</div>
<Drawer {...args}>
<Drawer.Trigger>
<Button className="m-4 self-start">Order details</Button>
</Drawer.Trigger>
<p>{children}</p>
<Drawer.Footer>
<Button>Print label</Button>
</Drawer.Footer>
</Drawer>
</div>
);
},
};Inline Start
Select a folder to see its messages.
export const InlineStart: Story = {
args: {
type: 'inline',
position: 'start',
separator: true,
title: 'Folders',
children: 'Inbox, Drafts, Sent and Archive.',
},
render: function InlineStartDrawer({ children, ...args }) {
const [open, setOpen] = React.useState(true);
const toggleRef = React.useRef<HTMLButtonElement>(null);
const handleOpenChange: NonNullable<DrawerProps['onOpenChange']> = (next, details) => {
setOpen(next);
args.onOpenChange?.(next, details);
};
const paneId = 'inline-start-folders';
return (
<div className="flex h-96 flex-col rounded-md border border-wave-border">
<div className="flex items-center gap-2 border-b border-wave-border p-2">
<Button
ref={toggleRef}
aria-expanded={open}
aria-controls={open ? paneId : undefined}
onClick={() => setOpen((value) => !value)}
>
Folders
</Button>
<span className="text-wave-body-1 font-semibold">Mail</span>
</div>
<div className="flex min-h-0 flex-1">
{/* The story owns the controlled pair; every other arg is forwarded. */}
<Drawer
{...args}
id={paneId}
open={open}
onOpenChange={handleOpenChange}
finalFocusRef={toggleRef}
>
<p>{children}</p>
</Drawer>
<div className="min-w-0 flex-1 p-4">
<p>Select a folder to see its messages.</p>
</div>
</div>
</div>
);
},
};Inline Bottom
The editor area. The problems pane below keeps its height.
export const InlineBottom: Story = {
args: {
type: 'inline',
position: 'bottom',
separator: true,
defaultOpen: true,
title: 'Problems',
children: 'No problems in the open files.',
},
render: function InlineBottomDrawer({ children, ...args }) {
return (
<div className="flex h-128 flex-col rounded-md border border-wave-border">
<div className="min-h-0 flex-1 p-4">
<p>The editor area. The problems pane below keeps its height.</p>
</div>
<Drawer {...args}>
<Drawer.Trigger>
<Button className="mx-4 mb-2 self-start">Problems</Button>
</Drawer.Trigger>
<p>{children}</p>
</Drawer>
</div>
);
},
};Motion
export const Motion: Story = {
render: function MotionDrawers({ children, title: _title, ...args }) {
return (
<div className="flex flex-wrap gap-2">
{motionCases(panelFade).map(({ label, motion }) => (
// The story renders one drawer per case; every other arg is forwarded.
<Drawer
key={label}
{...args}
title={label}
motion={motion}
backdropMotion={typeof motion === 'string' ? backdropFade : motion}
>
<Drawer.Trigger>
<Button>{label}</Button>
</Drawer.Trigger>
<p>{children}</p>
<Drawer.Footer>
<Drawer.Close>
<Button appearance="primary">Apply</Button>
</Drawer.Close>
</Drawer.Footer>
</Drawer>
))}
</div>
);
},
};Inline Motion
Orders received this week.
Orders received this week.
Orders received this week.
export const InlineMotion: Story = {
args: {
type: 'inline',
separator: true,
title: 'Order 1042',
children: 'Two items, shipped on Monday to the warehouse in Lyon.',
},
render: function InlineMotionDrawers({ children, title: _title, ...args }) {
return (
<div className="flex flex-col gap-3">
{motionCases(slowCollapse).map(({ label, motion }) => (
<div key={label} className="flex h-48 rounded-md border border-wave-border">
<div className="flex min-w-0 flex-1 flex-col gap-2 p-4">
<p>Orders received this week.</p>
</div>
{/* The story renders one drawer per case; every other arg is forwarded. */}
<Drawer {...args} title={label} motion={motion}>
<Drawer.Trigger>
<Button className="m-4 self-start">{label}</Button>
</Drawer.Trigger>
<p>{children}</p>
</Drawer>
</div>
))}
</div>
);
},
};Responsive Type
Orders received this week.
export const ResponsiveType: Story = {
args: {
separator: true,
title: 'Filters',
children: 'Narrow the list of orders.',
},
render: function ResponsiveTypeDrawer({ children, ...args }) {
const wide = useMediaQuery('(min-width: 1024px)');
const [open, setOpen] = React.useState(wide);
const [wasWide, setWasWide] = React.useState(wide);
const [keyword, setKeyword] = React.useState('');
if (wide !== wasWide) {
setWasWide(wide);
setOpen(wide);
}
const handleOpenChange: NonNullable<DrawerProps['onOpenChange']> = (next, details) => {
setOpen(next);
args.onOpenChange?.(next, details);
};
return (
<div className="flex h-96 rounded-md border border-wave-border">
<div className="flex min-w-0 flex-1 flex-col gap-3 p-4">
<p>Orders received this week.</p>
</div>
{/* The story owns the controlled pair and the type; every other arg is forwarded. */}
<Drawer
{...args}
type={wide ? 'inline' : 'overlay'}
open={open}
onOpenChange={handleOpenChange}
>
<Drawer.Trigger>
<Button className="m-4 self-start">Filters</Button>
</Drawer.Trigger>
<div className="flex flex-col gap-3">
<p>{children}</p>
<Field label="Keyword">
<Input value={keyword} onValueChange={setKeyword} />
</Field>
</div>
</Drawer>
</div>
);
},
};Light Dismiss
Page content
export const LightDismiss: Story = {
args: { modalType: 'non-modal', lightDismiss: true, title: 'Filters' },
render: (args) => (
<div className="flex items-center gap-2">
<Drawer {...args}>
<Drawer.Trigger>
<Button appearance="primary">Open filters</Button>
</Drawer.Trigger>
<p>Click on the page to close this drawer.</p>
</Drawer>
<p>Page content</p>
</div>
),
};Mount Node
export const MountNode: Story = {
render: function MountNodeDrawer(args) {
const [open, setOpen] = React.useState(false);
const [node, setNode] = React.useState<HTMLElement | null>(null);
return (
<div className="flex flex-col gap-3">
<Button onClick={() => setOpen(true)}>Open drawer</Button>
<div ref={setNode} className="text-wave-body-1">
The drawer renders inside this box.
</div>
<Drawer
{...args}
open={open}
onOpenChange={(next) => setOpen(next)}
mountNode={node}
title="Mounted in a node"
>
Content
</Drawer>
</div>
);
},
};Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
open | boolean | No | Controlled open state of the drawer. An overlay drawer's panel renders only in the browser: open, it is closed in the server HTML and opens once it has hydrated. An inline drawer renders in the server HTML: open, or hidden when kept mounted ( | |
defaultOpen | boolean | No | false | Default open state for uncontrolled usage. An overlay drawer open by default is closed in the server HTML and opens once it has hydrated; an inline one is open in the server HTML. |
onOpenChange | (open: boolean, details: DrawerOpenChangeDetails) => void | No | Called with the new open state when it changes. Fires only when the value changes; a controlled drawer stays as it is until the parent updates | |
type | 'overlay' | 'inline' | No | 'overlay' | How the drawer sits on the page (Fluent's Changing |
separator | boolean | No | false | Inline drawers: draws a line on the panel's inner edge, the edge facing the page content ( |
position | 'start' | 'end' | 'left' | 'right' | 'bottom' | No | 'end' | Side of the screen the drawer is attached to. |
size | 'small' | 'medium' | 'large' | 'full' | No | 'small' | The panel's width at a side — |
modalType | 'modal' | 'alert' | 'non-modal' | No | 'modal' |
|
lightDismiss | boolean | No | false | Light dismiss of a |
backdrop | Slot<'div'> | (SlotObject<'div'> & { appearance?: BackdropAppearance }) | No | The backdrop of a modal or alert drawer, as | |
motion | MotionSlot | null | No | the slide (overlay) or the collapse (inline) above | The drawer's motion. By default an overlay panel slides in from beyond its edge and fades in with a decelerating curve, and slides back out and fades out with an accelerating curve; the |
backdropMotion | MotionSlot | null | No | the fade above | The backdrop's motion (a modal or alert overlay). By default it fades in and out with a linear curve over the panel's duration (250 to 500 ms, by |
closeButton | Slot<'span'> | No | Content of the built-in Close button, in the built-in header and in every | |
titleAction | Slot<'span'> | No | Header buttons for the | |
title | React.ReactNode | No | Title displayed in the built-in header; it names the drawer ( | |
closeLabel | string | No | 'Close' | Accessible name of the built-in Close button (an icon-only button), in the built-in header and in every |
finalFocusRef | React.RefObject<HTMLElement | null> | No | Where focus goes when the drawer closes, if it can take focus. Otherwise focus returns to the element that had focus when the drawer opened, then to the trigger, then to an element next to where that opener was. An inline or non-modal drawer moves focus on close only when focus was inside it. | |
unmountOnClose | boolean | No | true | Removes the panel and its content when the drawer closes, once the panel's exit motion has ended. |
mountNode | HTMLElement | null | No | the provider's `portalContainer`, else `document.body` | The element an overlay drawer's panel and backdrop render into, in place of the |
children | React.ReactNode | Yes | The drawer's content, placed by the Drawer, also from a Fragment ( | |
ref | React.Ref<HTMLElement> | No | Ref to the panel: the | |
slotProps | { header?: SlotPart<'div'> } | No | Props for the elements the drawer draws around your content, by part, merged into each part's own: your classes after the part's (yours win a conflict), your styles over its styles, your attributes and handlers added, your ref attached. Every attribute the drawer sets on a part is locked and keeps the drawer's value; you add the attributes it does not set. A part takes no |
Any other prop is passed to the element it renders (HTMLElement).
Parts
headerDrawer.TriggerDrawer.CloseDrawer.TitleDrawer.HeaderDrawer.HeaderTitleDrawer.HeaderNavigationDrawer.BodyDrawer.Footer
Stable class names
| Part | Class |
|---|---|
root | wave-drawer |
backdrop | wave-drawer__backdrop |
collapse | wave-drawer__collapse |
header | wave-drawer__header |
titleAction | wave-drawer__title-action |
closeButton | wave-drawer__close-button |
body | wave-drawer__body |