Skip to Content
Documentation
Saas UI
Get Pro
Getting started
Components
Overview

Drawer

Used to render a content that slides in from the side of the screen.

SourceStorybookRecipeArk

Anatomy

import { Drawer } from '@saas-ui/react/drawer'
<Drawer.Root>
  <Drawer.Backdrop />
  <Drawer.Trigger />
  <Drawer.Content>
    <Drawer.Header>
      <Drawer.Title />
      <Drawer.CloseButton />
    </Drawer.Header>
    <Drawer.Body />
    <Drawer.Footer>
      <Drawer.CloseTrigger asChild>
        <Button>Close</Button>
      </Drawer.CloseTrigger>
    </Drawer.Footer>
  </Drawer.Content>
</Drawer.Root>

Examples

Attached

Use the attached prop to render the drawer to attach to the edge of the viewport.

Sizes

Use the size prop to change the size of the drawer component.

Offset

Pass the offset prop to the DrawerContent to change the offset of the drawer component.

Placement

Use the placement prop to change the placement of the drawer component.

Initial Focus

Use the initialFocusEl prop to set the initial focus of the drawer component.

Props

Root

PropDefaultType
colorPalette 'gray'
'gray' | 'zinc' | 'neutral' | 'stone' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'presence' | 'status' | 'sidebar' | 'sidebar.accent' | 'accent' | 'slate'

The color palette of the component

size 'xs'
'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full'

The size of the component

placement 'end'
'start' | 'end' | 'top' | 'bottom'

The placement of the component

attached
'true' | 'false'

The attached of the component

as
React.ElementType

The underlying element to render.

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.
unstyled
boolean

Whether to remove the component's style.

Previous

Dialog

Next

Editable