Drawer

1.0.0

Accessible swipeable drawer with trigger, overlay, header, description, and footer composed on Base UI.

Component data

ID
drawer
Category
atoms
Version
1.0.0
Added
2026-09-17
Type
component
Keyboard nav
Yes
Reduced motion
Yes
drawersheetoverlayprimitiveaccessible

Dependencies

  • @base-ui/react
  • clsx
  • tailwind-merge
  • react

Registry

  • button

Examples

Default

<Drawer>
      <DrawerTrigger
        render={
          <Button variant="secondary">{drawerMocks.default.trigger}</Button>
        }
      />
      <DrawerContent>
        <DrawerHeader>
          <DrawerTitle>{drawerMocks.default.title}</DrawerTitle>
          <DrawerDescription>
            {drawerMocks.default.description}
          </DrawerDescription>
        </DrawerHeader>
        <div className="p-4 text-sm text-muted-foreground">
          {drawerMocks.default.body}
        </div>
        <DrawerFooter>
          <Button>{drawerMocks.default.confirm}</Button>
          <DrawerClose
            render={
              <Button variant="secondary">{drawerMocks.default.cancel}</Button>
            }
          />
        </DrawerFooter>
      </DrawerContent>
    </Drawer>

Variants

<Drawer showSwipeHandle swipeDirection="right">
      <DrawerTrigger
        render={<Button variant="secondary">{drawerMocks.side.trigger}</Button>}
      />
      <DrawerContent>
        <DrawerHeader>
          <DrawerTitle>{drawerMocks.side.title}</DrawerTitle>
          <DrawerDescription>{drawerMocks.side.description}</DrawerDescription>
        </DrawerHeader>
        <div className="flex-1 overflow-y-auto p-4 text-sm text-muted-foreground">
          {drawerMocks.side.body}
        </div>
        <DrawerFooter>
          <Button>{drawerMocks.side.confirm}</Button>
          <DrawerClose
            render={
              <Button variant="secondary">{drawerMocks.side.cancel}</Button>
            }
          />
        </DrawerFooter>
      </DrawerContent>
    </Drawer>

Related