Skip to content

Drawer

A bottom sheet with its own trigger. It slides up over a dimmed page, follows your finger when you pull it down, and returns focus to the button that opened it.

On this page
Used for
  • Pick a model on a phone
  • Run details
  • Filters on mobile
  • Approve a tool call
  • Share sheet

Examples

Installation

npx knowns-ui@latest add drawer
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

trigger
ReactElement
Opens the drawer. Cloned with onClick, aria-haspopup and aria-expanded.
open / defaultOpen / onOpenChange
boolean / boolean / (open) => void
Controlled or uncontrolled.
title / description
ReactNode
The header. Give a label instead when there is no title.
height
"auto" | "half" | "full"
Default"auto"
Fit the content up to 85% of the screen, or fix the height.
children / footer
ReactNode | (close) => ReactNode
Content and a muted action strip. A function gets close.
dragToDismiss
boolean
Defaulttrue
Pull the handle or header down to close.
Motion
280ms ease-out
Transform and opacity only, the same slide as Sheet. Reduced motion fades.

What it handles

  1. 01Slides up from the bottom edge over a dimmed backdrop and slides back down on close.
  2. 02Dismisses by pulling the handle or the header down, past 30% of its height or with a quick flick, and follows the finger while you drag.
  3. 03Traps focus while open, closes on Escape or the backdrop, locks the page scroll and returns focus to the trigger.
  4. 04Takes a trigger, so it opens itself, or stays controlled with open and onOpenChange.
  5. 05Fits its content up to 85% of the screen, or fixes the height at half or full.
  6. 06Hands your content a close function, so a row or a button inside can dismiss it.

States

First render
Nothing. It is closed and takes no space
none
Open
The panel slides up and the backdrop fades in
280ms, ease out
Close
The panel slides down and the backdrop fades out
about 190ms, ease out
Drag
The panel follows the pointer with no easing
none
Reduced motion
The panel fades instead of sliding
opacity only

Works with

When to use

When to use

  • A short task on a phone: pick a model, set filters, approve a call, from a bottom edge.

When not to use

  • A tall panel from the side: use Sheet.
  • A confirmation on desktop: use Dialog.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Drawer to my app and wire it to my own data.
  • I need a short task on a phone: pick a model, set filters, approve a call, from a bottom edge. Set that up with the Knowns UI Drawer.
  • Which Drawer props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "drawer" }) and search_docs({ query: "drawer" }).

Need help?

Stuck on Drawer, or found something off? We read every message.