Skip to Content
DocsResourcesPricingShowcase

Drawer

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

SourceStorybookRecipeArk

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>

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

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

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

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

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

PropDefaultType
colorPalette 'gray'
'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent'

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

contained
'true' | 'false'

The contained 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