Drawer

Modal panel anchored to a viewport edge.

Add it to your project

Eject the complete drawer group, then import from its generated local barrel. The copied source and CSS belong to your application.

bash
pnpm exec toucan eject drawer
app.tsx
import { Drawer } from '@/components/toucan/drawer';

Use when

Supporting content or a task should slide in without replacing the route.

Avoid when

The content is a small contextual menu or non-modal hint.

Example

API reference

Generated from packages/react/src/components. Only Toucan-specific props are listed; forwarded native props remain available as noted for each export.

Drawer

Drawer

Props type: DrawerProps

NameTypeDefaultRequiredDescription
anchor"left" | "right" | "top" | "bottom"'right'NoThe edge or alignment used to position the floating content.
closeOnBackdropClickbooleantrueNoClose when the user activates the backdrop.
closeOnEscapebooleantrueNoClose when the user presses Escape.
onClose() => void—RequiredCalled when the component requests to close.
openboolean—RequiredControlled open state.
size"sm" | "md" | "lg"'md'NoVisual size variant.

Also accepts the native div attributes that are not replaced by a Toucan prop.

Type exports

DrawerProps

Accessibility

  • Uses dialog semantics, focus trapping, Escape dismissal, and focus restoration.
  • Provide an accessible name.

Token families

drawerbackdropfocus

Related components