Skip to content
GitHub (opens in a new tab)

Drawer

Edge panel for secondary tasks. Floating sheet inset from the opening edge.

stableOrganismcontracts/drawer.json

Preview

Drawer

Edge panel. Not Modal. Not AlertDialog.

Master

Bottom sheet for a delivery window, medium size, no close button. Overlay click and Escape dismiss. Variants shows each side and size.

Usage

Use Drawer for a sheet or side panel. Size is sm, md, or lg for left/right/bottom. Use lg when the body has DatePicker or other overlays that must fit without horizontal scroll. Compose kit RadioGroup for the slots and kit Buttons in the footer. Use Modal for a centered short task. Use AlertDialog when they must choose.

Do's

  • Settings
  • Filters
  • Detail alongside the page
  • Mobile-style sheet from the bottom

Don'ts

  • Centered short task — use Modal
  • Must-choose confirm — use AlertDialog
  • Persistent nav list — use SideNav (product) or DocsNav (docs/catalog)
  • Closeable app chrome — use SideNav
  • Full page — use a route
<Drawer
  open={open}
  title="Pick a delivery time"
  description="We'll prepare your order as soon as possible."
  side="bottom"
  showClose={false}
  onClose={close}
  footer={
    <>
      <Button appearance="solid" mode="primary" size="lg" shape="pill" block>Confirm Delivery Time</Button>
      <Button appearance="outline" mode="neutral" size="lg" shape="pill" block onClick={close}>Cancel</Button>
    </>
  }
>
  <RadioGroup
    name="delivery-time"
    legend="Delivery time"
    hideLegend
    layout="card"
    defaultValue="standard"
    options={slots}
  />
</Drawer>

When to use

  • Settings
  • Filters
  • Detail alongside the page
  • Mobile-style sheet from the bottom

When not to use

  • Centered short task — use Modal
  • Must-choose confirm — use AlertDialog
  • Persistent nav list — use SideNav (product) or DocsNav (docs/catalog)
  • Closeable app chrome — use SideNav
  • Full page — use a route

What an agent reads

import { Drawer } from "agentic-ds-kit";
must
  • role=dialog and aria-modal
  • Title (h2, the shared ModalCard header) is the accessible name, description is aria-describedby when present
  • Focus starts on the first field in the body, not Close; with no field the panel itself takes focus
  • Focus is trapped while open and the page behind is inert
  • Escape closes, unless an open panel inside it (Select, DatePicker) handles that Escape first
  • Overlay click closes
  • Scroll lock keeps the scrollbar gutter
  • Focus returns to the opener on close (Escape, Close or overlay click); if the opener is gone, to the page heading (or main)
  • Unique ids via useId
  • built-in labels (close) come from KitLabelsProvider; English by default
defaults
  • tone neutral
  • side right
  • size md
  • showClose true
stops if
  • Do not invent Sheet, SidePanel, or local Drawer
  • Do not use raw hex
  • Do not add snap points or swipe
  • Do not skip the close control unless showClose is false AND footer/body still provide a way out. Overlay click and Escape still close.

From contracts/drawer.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
openbooleanYes——
titlestringYes——
descriptionstringNo——
eyebrowstringNo—Short area name in the header row, 12px, like Billing · Invoices. Caller-provided.
toneenumNoneutralTone icon (16px, aria-hidden) and status word from KitLabels (info, success, warning, danger) before the eyebrow, so status is never colour alone. neutral shows the eyebrow only. neutral | info | success | warning | danger
sideright | left | bottom | topNorightFloating sheet with radius-surface-lg. Right/left inset from top, bottom, and the opening edge. Bottom is centered. Top insets from top, left, and right. Not a flush full-bleed bar. Below 480px (30rem) left and right open as the bottom sheet (full width inside the 16px inset, no handle, no swipe).
sizesm | md | lgNomdWidth for left/right/bottom sheets (layout-drawer-*). Use lg when the body has DatePicker or other overlays that must fit without horizontal scroll. Top stays full width.
fullScreenBelowsm | mdNo—Opt-in. Below --grid-breakpoint-sm (40rem) or -md (64rem) a left or right Drawer fills the screen (no inset, radius or border) instead of becoming the bottom sheet. For a dense panel such as a mapping table. Default: off.
showClosebooleanNotrue—
onClosefunctionYes——
childrenslotYes—Body. Kit blocks that know the Drawer adapt: SideNav fills the body (no rail width, border or card frame) and stays open.
footerslotNo—kit Buttons. Left/right: one row, actions on the right (Cancel, then one primary), size sm. Bottom and the 480px sheet stack them full width, actions first, then footerStart; on bottom use shape=pill and block.
footerStartslotNo—Left of the footer actions, first in the footer tab order: an Ask Button (appearance outline, mode neutral, size sm, iconStart MessageCircle) or a count like 6 of 6 selected. Labels are caller-provided.
  • Component
    →

    Modal

    Dismissible overlay for short tasks, forms, or extra detail.

  • Component
    →

    AlertDialog

    Must-choose overlay that interrupts until the user cancels or confirms.

  • Component
    →

    SideNav

    Product side nav: brand header, icon items, optional badges, closeable; variant single (one column that closes to an icon rail) or rail-subnav (a fixed icon rail plus a SideNav.SubNav column with the picked parent's rows).

  • Component
    →

    DocsNav

    Docs and catalog sidebar only: title, grouped text-only links, optional decorative icons and muted counts on group and subgroup headers only, an active page pill and optional footer links.