Talisman LogoTalisman Logo Design System
Browse documentation
Components

Drawer

A side panel that shows the details of the item the user selected, built on Vaul, and opens from the right edge of the page.

Stableimport { Drawer } from "@repo/ui/drawer";Source

Select the button to open the panel. Use the footer button, Escape or a click on the backdrop to close it.

When to use

  • To show the details of a row, a movement or a task without leaving the list.
  • When the content can be longer than the viewport: the panel scrolls.
  • For read-mostly content with a few actions in the footer, such as “Iniciar revisão”.

When not to use

  • Forms and filters. Use a Sheet: it has padding, a built-in close button and can open from any edge.
  • A decision or a confirmation. Use Dialog or Alert dialog.
  • Opening from the bottom or the left. The component always renders on the right. Use a Sheet.
  • A list of actions. Use Dropdown menu.

Which one to use

Component Opens from Closes with Scrolls Use for
Dialog Center Corner ×, Escape, backdrop click No Short tasks, confirmations
Alert dialog Center Footer buttons, Escape No Irreversible actions
Drawer Right only DrawerClose, Escape, backdrop click Yes Details of the selected item
Sheet Any edge Corner ×, Escape, backdrop click No Filters, forms, navigation

Drawer and Sheet

Both are modal side panels and both sit on Radix Dialog, so focus handling and Escape match. The source differs in three ways:

  • Engine. The Drawer wraps Vaul, which adds drag gestures, snap points and background scaling on top of Radix Dialog. The Sheet uses Radix Dialog directly with CSS slide animations.
  • Gestures. The wrapper sets handleOnly and exports no Drawer.Handle, so nothing can start a swipe. In practice the Drawer closes like a Sheet does. shouldScaleBackground defaults to true, but only an element with data-vaul-drawer-wrapper scales, and no app page has one.
  • Layout. The Drawer is a fixed w-96 panel on the right with overflow-y-auto, no padding on the content and no close button. The Sheet has side, 24px of padding, a corner × and no scrolling.

Anatomy

Part Role
Drawer Holds the open state and the Vaul options.
DrawerTrigger The element that opens it. Use asChild with a Button.
DrawerContent The panel and its backdrop.
DrawerHeader Groups the title and the description. Has 20px of padding.
DrawerTitle Names the panel. Required for assistive technology.
DrawerDescription One sentence of context.
DrawerFooter The actions, pushed to the bottom with mt-auto. Has 16px of padding.
DrawerClose Closes the drawer. Use asChild with a Button. The panel has no built-in ×.

Content between the header and the footer needs its own padding (px-5 matches the header).

Examples

Details with a close action

Details with a main action

Put the main action first and DrawerClose last: the footer is a column.

Content

  • Title the panel with the object: “Movimentação de 12/03/2025”, “Revisar contestação”.
  • Use the description for the identifier the user searches by, such as the process number.
  • Always provide a DrawerClose button. There is no corner ×.

Accessibility

  • Vaul is built on Radix Dialog: the panel has role="dialog" and is labelled by DrawerTitle and described by DrawerDescription. Always include both.
  • Focus moves into the panel on open, stays inside and returns to the trigger on close. Escape and a click on the backdrop close it. The page behind is inert.
  • The wrapper turns on handleOnly and renders no handle, so there is no gesture to learn and no keyboard difference between pointer and keyboard users.
  • Without a corner ×, keyboard and screen reader users depend on DrawerClose and Escape. Always include a close button in the footer.

Code

import { Button } from "@repo/ui/button";
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@repo/ui/drawer";

<Drawer>
  <DrawerTrigger asChild>
    <Button variant="secondary">Ver detalhes da movimentação</Button>
  </DrawerTrigger>
  <DrawerContent>
    <DrawerHeader>
      <DrawerTitle>Movimentação de 12/03/2025</DrawerTitle>
      <DrawerDescription>Processo 0001234-56.2024.8.26.0100</DrawerDescription>
    </DrawerHeader>
    <DrawerFooter>
      <DrawerClose asChild>
        <Button variant="secondary">Fechar</Button>
      </DrawerClose>
    </DrawerFooter>
  </DrawerContent>
</Drawer>;

Props

Drawer
PropTypeDefaultDescription
defaultOpenbooleanfalseInitial open state when the drawer is uncontrolled
direction"bottom" | "right""right"Edge the drawer opens from. The wrapper types it as `bottom` or `right`, but the content classes always place the panel on the right
dismissiblebooleantrueAllows closing with `Escape`, a click outside or a swipe
modalbooleantrueBlocks interaction with the rest of the page while open
onOpenChange(open: boolean) => void—Called when the drawer opens or closes
openboolean—Controlled open state
shouldScaleBackgroundbooleantrueScales the element marked with `data-vaul-drawer-wrapper` while open. Has no effect when no element carries that attribute
DrawerTrigger, DrawerClose
PropTypeDefaultDescription
asChildbooleanfalseRenders the child element instead of a button, for DrawerTrigger and DrawerClose.
DrawerContent
PropTypeDefaultDescription
classNamestring—Extra classes for the panel. The panel is fixed to the right edge with `w-96`.
onEscapeKeyDown(event: KeyboardEvent) => void—Called when `Escape` is pressed. Call `event.preventDefault()` to keep the drawer open.

Known issues

Issue Effect
direction accepts "bottom", but DrawerContent always has inset-y-0 right-0 h-full w-96. A bottom drawer still renders as a right panel, so the prop is misleading.
The backdrop is bg-black/80, a translucent fill. The repository avoids transparency in UI.
shouldScaleBackground defaults to true, but no element carries data-vaul-drawer-wrapper. The default does nothing in the apps. The prop is dead weight.
There is no close button and no handle, and handleOnly is always on. Each use must add its own DrawerClose. Without it only Escape and the backdrop close the panel.
DrawerTitle is text-sm font-normal leading-none and not Typography. The title looks like body text and does not follow the type scale tokens.
DrawerContent has no padding and the header and footer use p-5 and p-4. Content in between must add its own padding, and header and footer are not aligned with each other.
Edit this page on GitHub