Skip to content
SENVENLI UI

Drawer

A panel that slides in from the side, or a bottom sheet on phones, for detail and edit views beside the page.
A record beside the page
import { Drawer } from "@senvenli/react/overlay";

Examples

Unsaved changes

Closing asks first while there are edits; saving closes without the question.

From any edge

`position`: start, end (default), top or bottom; the app decides, at every width.

From the bottom

`position="bottom"` is a sheet that snaps between half and full height.

Guidelines

When to use it

  • Viewing or editing a record while keeping the list in view.

Use something else when

  • The task needs full attention. Dialog

Accessibility

Keyboard

KeysWhat happens
EscCloses, asking first when there are unsaved changes.

Built in

  • Unsaved changes ask before closing in a real nested modal.
  • The bottom sheet has a grip to expand or close.

You provide

  • A title.

API reference

Drawer

isOpen
boolean

Open without a DialogTrigger (a URL, a row click). Inside a DialogTrigger, put onOpenChange on the trigger instead: the trigger owns the state there.

defaultOpen
boolean
onOpenChange
(isOpen: boolean) => void
titleRequired
React.ReactNode
description
React.ReactNode

Under the title: "Jordan Lee · 14–18 Oct". When given, the drawer is described by it (aria-describedby); without it (or with "", false, null) nothing is rendered.

headerActions
React.ReactNode

Beside the close button: a status Badge, a menu.

childrenRequired
React.ReactNode
footer
React.ReactNode

Sticky at the bottom: the record's actions.

size
OverlaySize

small 380px, large 560px (medium reads as large).

position
DrawerPosition

The edge it slides in from, at every width (the app decides, e.g. bottom on phones): end (default) and start are the inline sides and mirror in right-to-left; bottom is a sheet that snaps between half and full height; top drops down from above.

hasUnsavedChanges
boolean

Closing (button, Esc, scrim, useDrawerClose) asks first: "Unsaved changes".

motion
ComponentMotion

auto (follow the device), reduce or none, for this component; the provider's setting otherwise.