Drawer

Loading...

Installation

Install the component via the CLI in one command.

npx shadcn@latest add @intentui/drawer

Composed components

When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.

Manual installation

Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.

npm install react-aria-components motion tailwind-merge

Anatomy

import { Button } from "@/components/ui/button"
import {
  Drawer,
  DrawerBody,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/ui/drawer"
<Drawer>
  <DrawerTrigger>Open Drawer</DrawerTrigger>
  <DrawerContent>
    <DrawerHeader>
      <DrawerTitle>Drawer Title</DrawerTitle>
      <DrawerDescription>Drawer Description</DrawerDescription>
    </DrawerHeader>
    <DrawerBody>Drawer Body</DrawerBody>
    <DrawerFooter>
      <DrawerClose>Close</DrawerClose>
      <Button>Confirm</Button>
    </DrawerFooter>
  </DrawerContent>
</Drawer>

Examples

Side

Use the side prop to change where the drawer appears. The default is left, but you can also use right, top, or bottom.

Loading...

Float

To make the drawer float with spacing around it, set the isFloat prop to true. The default value is false.

Loading...

Controlled

Manage the drawer’s open and close state programmatically.

Loading...

Without notch

Remove the default notch styling by setting the notch prop to false.

Loading...

Sticky

The drawer handles long content gracefully. Try scrolling within it.

Loading...

Nested

Drawers can be nested inside each other for advanced layouts.

Loading...

Component API

Drawer

Drawer extends the React Aria Components <DialogTrigger> component.

DrawerTrigger

DrawerTrigger extends the React Aria Components <Button> component.

classNamestring

DrawerBody

DrawerBody extends the native <div> element.

classNamestring

DrawerClose

DrawerClose extends the Intent UI <Button> component.

classNamestring

DrawerContent

DrawerContent extends the React Aria Components <ModalOverlay> component.

classNamestring
isFloatboolean
Default: false
notchboolean
Default: true
overlayPick<ModalOverlayProps, "className">
side"top" | "bottom" | "left" | "right"
Default: bottom

DrawerDescription

DrawerDescription extends the React Aria Components <Text> component.

classNamestring

DrawerFooter

DrawerFooter extends the native <div> element.

classNamestring

DrawerHeader

DrawerHeader extends the native <div> element.

classNamestring

DrawerTitle

DrawerTitle extends the React Aria Components <Heading> component.

classNamestring

See the React Aria and Motion for the full API reference.

Design