Aliases
side sheet
components / drawer
Edge-anchored dialog surface for contextual tasks, side sheets, and longer-form secondary workflows.
Playground
Start here. Switch systems, interact with the shipped component, and let the rest of the page answer the why and how after the behavior clicks.
Cobalt
The crisp default DK action system: bright primary, roomy spacing, and a direct editorial rhythm.
Overview
This section explains the intent of the component before the implementation details.
Aliases
side sheet
Explore the math
Decision guide
Use these notes to decide quickly whether this is the right DK component for the job.
Decision guide
Do
Do not
Usage
Prefer these situations when choosing this component.
Usage
These patterns are better served by a different component or a simpler surface.
Anti-patterns
Migration notes
Anatomy
The anatomy explains which pieces matter to the recipe and accessibility model.
open affordance
triggerControl that opens the drawer.
edge sheet
surfaceSide-anchored overlay surface.
optional footer actions
footerOptional actions area inside the drawer.
API
The docs contract distinguishes props, DOM events, and slots so integration behavior is explicit.
Props
| Name | Type | Default | Description |
|---|---|---|---|
open | boolean | false | Controlled open state. |
side | 'left' | 'right' | 'right' | Chooses the drawer edge. |
size | 'sm' | 'md' | 'lg' | 'md' | Chooses the drawer width recipe. |
title | string | — | Drawer title. |
description | string | — | Optional supporting explanation. |
closeOnEscape | boolean | true | Allows Escape to close the drawer. |
closeOnOutsidePress | boolean | true | Allows outside press dismissal. |
onOpenChange | (detail: { open: boolean }) => void | — | Callback fired when the drawer opens or closes. |
theme | ThemeContract | — | Overrides the compiled DK theme used to resolve tokens and recipes for this component. |
Events
| Name | Payload | Description |
|---|---|---|
openchange | { open: boolean } | Fires when an overlay-style component opens or closes through user interaction. |
Slots
| Name | Description |
|---|---|
trigger | Optional trigger content. |
default | Drawer body content. |
footer | Optional footer actions. |
Recipes
These notes summarize the intended recipe surface rather than exposing raw implementation detail first.
Variants
Sizes
States
Accessibility
This is the behavior the component promises to assistive tech and keyboard users today.
Semantics
Keyboard
Screen readers
Checklist
Implementation
This section shows the representative compiled slot variables that the runtime consumes for the selected design system.
Implementation notes
Implementation checklist
Examples
Each example is intentionally practical, grouped by starter, common pattern, and edge-case coverage.
Starter
1 example
starter
Starter: side inspectorA right-side secondary workflow surface.
Copy snippet
<Drawer title="Inspector" description="Secondary support flow."><svelte:fragment slot="trigger">Open drawer</svelte:fragment>Keep supporting work visible without leaving the page.</Drawer>Common patterns
1 example
common
Common: left-side sheetLeft-side drawers can support alternate app shells or editing flows.
Copy snippet
<Drawer side="left" title="Filters"><svelte:fragment slot="trigger">Open filters</svelte:fragment>Filter controls here.</Drawer>Edge cases
1 example
edge
Edge: externally controlled drawerControl open state when app workflow owns the sheet lifecycle.
Copy snippet
<Drawer open={isInspectorOpen} onOpenChange={(detail) => isInspectorOpen = detail.open} title="Inspector">Contextual details</Drawer>Verification
Proofs stay visible in the docs so the system shows what it can guarantee, not just what it can render.
side=left|size=sm
side=right|size=sm
side=left|size=md
side=right|size=md
side=left|size=lg
side=right|size=lg