Examples

Detail panel

Preview
Example.tsx
import { Badge, Button, DescriptionList, Drawer } from '@reactloom/ui';

export default function Example() {
  return (
    <Drawer.Root>
      <Drawer.Trigger variant="secondary">View invoice</Drawer.Trigger>
      <Drawer.Content>
        <Drawer.Header>
          <Drawer.Title>Invoice INV-2041</Drawer.Title>
          <Drawer.Description>Acme Corporation</Drawer.Description>
        </Drawer.Header>
        <Drawer.Body>
          <DescriptionList>
            <DescriptionList.Item term="Status"><Badge tone="warning" dot>Overdue</Badge></DescriptionList.Item>
            <DescriptionList.Item term="Amount">$12,400.00</DescriptionList.Item>
            <DescriptionList.Item term="Due">12 November 2026</DescriptionList.Item>
          </DescriptionList>
        </Drawer.Body>
        <Drawer.Footer>
          <Drawer.Close>Close</Drawer.Close>
          <Button>Send reminder</Button>
        </Drawer.Footer>
      </Drawer.Content>
    </Drawer.Root>
  );
}

Sides

start and end follow the text direction.

Preview
Example.tsx
import { Drawer, HStack } from '@reactloom/ui';

export default function Example() {
  return (
    <HStack gap="2">
      {(['start', 'end', 'bottom'] as const).map((side) => (
        <Drawer.Root key={side}>
          <Drawer.Trigger variant="secondary">{side}</Drawer.Trigger>
          <Drawer.Content side={side} size="sm">
            <Drawer.Header>
              <Drawer.Title>Drawer from {side}</Drawer.Title>
            </Drawer.Header>
            <Drawer.Body>start and end follow the text direction.</Drawer.Body>
          </Drawer.Content>
        </Drawer.Root>
      ))}
    </HStack>
  );
}

API reference

Drawer.Content

Drawer.Content
PropTypeDefault
side
'start' | 'end' | 'bottom''end'
size
Width (or height for bottom); token --pl-drawer-size.
'sm' | 'md' | 'lg''md'
…
Everything Dialog.Content accepts.
DialogContentProps—

Other parts

Other parts
PropTypeDefault
Root · Trigger · Header · Title · Description · Body · Footer · Close
Same as Dialog.
—

Customization

Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.

Renders DialogContent, so its hooks apply too.

Slot class names

Add classes to inner parts with classNames (className is shorthand for root): root, panel, closeButton.

CSS variables

VariableDefault
--pl-drawer-sizevar(--_size
--pl-dialog-radiusvar(--pl-radius-xl
--pl-dialog-width25rem
--pl-dialog-width35rem
--pl-dialog-width45rem
--pl-dialog-width60rem

State attributes

Target these in your CSS to style states without depending on class names.

AttributeValues
[data-drawer-size]present when on
[data-side]start · end · bottom
[data-size]sm · md · lg · xl · full

Theme tokens it reads

--pl-color-bg-overlay --pl-color-bg-surface-raised --pl-color-border-default --pl-color-fg-default --pl-color-fg-muted --pl-radius-xl --pl-shadow-lg

Accessibility

  • Identical to Dialog: inert background, focus return, Escape, labelled by Drawer.Title.
Keyboard interactions
KeyAction
EscapeClose
TabCycle inside the drawer

Usage guidelines

Do

  • Use for details and secondary tasks without leaving the page.

Don’t

  • Don’t stack drawers.