Drawer

Edge-anchored sheet / panel built on bits-ui Dialog. Supports right, left, top, and bottom anchors. Backdrop click and Escape close; focus is trapped while open.

Anchors

With Form

Long Content (Scrolling)

Props

Drawer.Root

PropTypeDefaultDescription
openbooleanfalseControls drawer visibility (bindable)
anchor'right' | 'left' | 'top' | 'bottom''right'Edge the drawer attaches to
onOpenChange(open: boolean) => voidCallback when open state changes
onClose() => voidCallback when drawer closes
onOpenAutoFocus(e: Event) => voidPassthrough to override initial focus target
classstringAdditional CSS classes
childrenSnippetDrawer content

Drawer.Header / Drawer.Body / Drawer.Footer

PropTypeDefaultDescription
classstringAdditional CSS classes
childrenSnippetSection content

Drawer.Close

PropTypeDefaultDescription
classstringAdditional CSS classes
childrenSnippet"x"Close button content

Usage

<script>
  import { Drawer, Button } from '@chrissnell/chonky-ui';

  let open = $state(false);
</script>

<Button onclick={() => (open = true)}>Open</Button>
<Drawer.Root bind:open anchor="right">
  <Drawer.Header>
    <h3>Details</h3>
    <Drawer.Close />
  </Drawer.Header>
  <Drawer.Body>
    <p>Panel content here.</p>
  </Drawer.Body>
  <Drawer.Footer>
    <Button onclick={() => (open = false)}>Close</Button>
  </Drawer.Footer>
</Drawer.Root>