# Drawer

> Slide a panel in from an edge that people can drag, snap, and swipe away.

Source: https://www.honestui.com/docs/components/drawer

```tsx
"use client"

import { Button } from "@/components/honest-ui/ui/button"
import {
  Drawer,
  DrawerClose,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerPopup,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/honest-ui/ui/drawer"
import { Field, FieldControl, FieldLabel } from "@/components/honest-ui/ui/field"
import { Form } from "@/components/honest-ui/ui/form"

export function DrawerDemo() {
  return (
    <Drawer>
      <DrawerTrigger
        render={(props) => (
          <Button {...props} variant="outline">
            Add payment method
          </Button>
        )}
      />
      <DrawerPopup>
        <Form
          className="mx-auto flex w-full max-w-md flex-col"
          onSubmit={(event) => event.preventDefault()}
        >
          <DrawerHeader>
            <DrawerTitle>Add a card</DrawerTitle>
            <DrawerDescription>
              Swipe down or press Escape to dismiss without saving.
            </DrawerDescription>
          </DrawerHeader>
          <div className="flex flex-col gap-4 px-4">
            <Field>
              <FieldLabel>Name on card</FieldLabel>
              <FieldControl autoComplete="cc-name" defaultValue="Ada Lovelace" />
            </Field>
            <Field>
              <FieldLabel>Card number</FieldLabel>
              <FieldControl
                autoComplete="cc-number"
                inputMode="numeric"
                placeholder="1234 1234 1234 1234"
              />
            </Field>
          </div>
          <DrawerFooter>
            <Button type="submit">Save card</Button>
            <DrawerClose
              render={(props) => (
                <Button {...props} variant="ghost">
                  Cancel
                </Button>
              )}
            />
          </DrawerFooter>
        </Form>
      </DrawerPopup>
    </Drawer>
  )
}

```

## Overview [#overview]

Use Drawer for a panel that people handle with their fingers: a bottom sheet on a phone, a route summary that peeks above a map, an action sheet of choices for one item. A drawer follows the pointer while it is dragged, settles at preset heights called snap points, and closes when it is swiped back toward its edge.

Drawer and [Sheet](/docs/components/sheet) look the same. They share the overlay surface, backdrop, header, footer, title, and close button. The difference is gestures. A Sheet is a dialog placed at an edge, and it opens and closes only through buttons, the backdrop, and <kbd>Escape</kbd>. A Drawer adds swipe-to-dismiss, snap points, and drag tracking on top of the same dialog behavior. If nobody will drag the panel, use Sheet: it is simpler and has nothing to swipe by accident.

## Anatomy [#anatomy]

A drawer has a root, a trigger, a backdrop, a viewport that positions the panel, the popup panel, a scrollable content region, and optional header, footer, title, description, and close parts. Top and bottom drawers draw a grab handle, which tells people the panel can be dragged. Left and right drawers show the close button instead, because a horizontal swipe is harder to discover.

`DrawerPopup` wraps its children in the Base UI content part. Text inside that region can be selected with a mouse without starting a drag. Add `data-base-ui-swipe-ignore` to any descendant that should never start a swipe, such as a horizontal slider.

## Sides and snap points [#sides-and-snap-points]

Set `side` on `Drawer` to `"bottom"` (the default), `"top"`, `"left"`, or `"right"`. The side also sets the dismiss gesture, so a bottom drawer closes with a downward swipe and a right drawer with a swipe to the right.

Pass `snapPoints` to stop a bottom drawer at preset heights. Numbers from 0 to 1 are fractions of the viewport height, larger numbers are pixels, and strings accept `px` or `rem`. The panel moves by `--drawer-snap-point-offset` and pads its bottom by the same amount, so the end of a long list stays reachable when the drawer is half open.

## Accessibility [#accessibility]

A drawer is a modal dialog. Focus moves into the panel when it opens and stays there, <kbd>Escape</kbd> closes it, and focus returns to the trigger afterwards. Always render a `DrawerTitle`, because it names the dialog for screen readers.

Swiping is never the only way to close a drawer. Keyboard and switch users can press <kbd>Escape</kbd> or use a `DrawerClose` button, and pointer users can tap the backdrop. Put a visible close or cancel action in drawers that hold a form, because people who use a mouse often don't think to swipe. The grab handle is decorative and hidden from assistive technology.

With reduced motion, the drawer fades in and out instead of sliding, and dragging still follows the pointer directly. The backdrop lightens as the drawer is dragged away, and the release animation runs faster after a quick flick. The panel honors safe-area insets, so content stays clear of the home indicator on phones.

## Installation [#installation]


  

  
    <CliBlock commands="[&#x22;drawer&#x22;]" />
  

  
    
      
        Install the following dependencies:
      

      ```bash
      npm install @base-ui/react
      ```

      
        Copy and paste the following code into your project.
      

      ### components/ui/drawer.tsx

```tsx
"use client"

import * as React from "react"
import { Drawer as DrawerPrimitive } from "@base-ui/react/drawer"
import { X as XIcon } from "honestui/icons"

import { cn } from "@/lib/utils"

type DrawerSide = "top" | "right" | "bottom" | "left"

// The side the drawer enters from, and the swipe that dismisses it.
const SWIPE_DIRECTION = {
  top: "up",
  right: "right",
  bottom: "down",
  left: "left",
} as const satisfies Record<DrawerSide, DrawerPrimitive.Root.Props["swipeDirection"]>

const DrawerSideContext = React.createContext<DrawerSide>("bottom")

function Drawer({
  side = "bottom",
  ...props
}: DrawerPrimitive.Root.Props & {
  side?: DrawerSide
}) {
  return (
    <DrawerSideContext.Provider value={side}>
      <DrawerPrimitive.Root
        data-slot="drawer"
        swipeDirection={SWIPE_DIRECTION[side]}
        {...props}
      />
    </DrawerSideContext.Provider>
  )
}

function DrawerTrigger(props: DrawerPrimitive.Trigger.Props) {
  return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
}

function DrawerPortal(props: DrawerPrimitive.Portal.Props) {
  return <DrawerPrimitive.Portal {...props} />
}

function DrawerClose(props: DrawerPrimitive.Close.Props) {
  return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
}

function DrawerBackdrop({ className, ...props }: DrawerPrimitive.Backdrop.Props) {
  return (
    <DrawerPrimitive.Backdrop
      data-slot="drawer-backdrop"
      className={cn(
        // The Sheet backdrop, faded by swipe progress so it lightens as the
        // drawer is dragged away. Release timing follows the swipe velocity.
        "fixed inset-0 z-[var(--hui-z-index-portal)] min-h-dvh bg-[var(--hui-color-overlay-black-a5)] [backdrop-filter:var(--hui-blur-lg)] opacity-[calc(1-var(--drawer-swipe-progress,0))] [transition:opacity_var(--hui-duration-drawer)_var(--hui-ease-drawer)] data-ending-style:opacity-0 data-starting-style:opacity-0 data-ending-style:[transition-duration:calc(var(--drawer-swipe-strength,1)*var(--hui-duration-drawer))] data-swiping:[transition-duration:0ms] [@media(prefers-reduced-transparency:reduce)]:bg-[var(--hui-color-overlay-black-a9)] [@media(prefers-reduced-transparency:reduce)]:[backdrop-filter:none]",
        className
      )}
      {...props}
    />
  )
}

const viewportClasses: Record<DrawerSide, string> = {
  bottom: "items-end justify-center",
  top: "items-start justify-center",
  right: "items-stretch justify-end",
  left: "items-stretch justify-start",
}

const popupClasses: Record<DrawerSide, string> = {
  // Snap points push a bottom drawer down by --drawer-snap-point-offset.
  // Matching bottom padding keeps the end of the content reachable, and the
  // ::after bleed fills the gap if the drawer is pulled past its height.
  bottom: cn(
    "w-full max-h-[calc(100dvh-var(--hui-space-12))] rounded-t-[var(--hui-radius-4)] border-t-[0.5px]",
    "[transform:translateY(calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px)))]",
    "[padding-bottom:max(env(safe-area-inset-bottom,0px),calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px)))] data-starting-style:[padding-bottom:0] data-ending-style:[padding-bottom:0]",
    "after:pointer-events-none after:absolute after:inset-x-0 after:top-full after:h-[var(--hui-space-12)] after:bg-inherit after:content-['']",
    "motion-safe:data-starting-style:[transform:translateY(100%)] motion-safe:data-ending-style:[transform:translateY(100%)]"
  ),
  top: cn(
    "w-full max-h-[calc(100dvh-var(--hui-space-12))] rounded-b-[var(--hui-radius-4)] border-b-[0.5px] pt-[env(safe-area-inset-top,0px)]",
    "[transform:translateY(var(--drawer-swipe-movement-y,0px))]",
    "after:pointer-events-none after:absolute after:inset-x-0 after:bottom-full after:h-[var(--hui-space-12)] after:bg-inherit after:content-['']",
    "motion-safe:data-starting-style:[transform:translateY(-100%)] motion-safe:data-ending-style:[transform:translateY(-100%)]"
  ),
  right: cn(
    "h-full w-[calc(100%-(--spacing(12)))] max-w-sm border-s-[0.5px]",
    "[transform:translateX(var(--drawer-swipe-movement-x,0px))]",
    "motion-safe:data-starting-style:[transform:translateX(100%)] motion-safe:data-ending-style:[transform:translateX(100%)]"
  ),
  left: cn(
    "h-full w-[calc(100%-(--spacing(12)))] max-w-sm border-e-[0.5px]",
    "[transform:translateX(var(--drawer-swipe-movement-x,0px))]",
    "motion-safe:data-starting-style:[transform:translateX(-100%)] motion-safe:data-ending-style:[transform:translateX(-100%)]"
  ),
}

function DrawerHandle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      aria-hidden="true"
      data-slot="drawer-handle"
      className={cn(
        "mx-auto my-[var(--hui-space-3)] h-1 w-10 shrink-0 rounded-[var(--hui-radius-full)] bg-[var(--hui-color-border-base-secondary)] forced-colors:bg-[CanvasText]",
        className
      )}
      {...props}
    />
  )
}

function DrawerPopup({
  className,
  children,
  showBackdrop = true,
  showHandle,
  showCloseButton,
  ...props
}: DrawerPrimitive.Popup.Props & {
  showBackdrop?: boolean
  /** Defaults to true for top and bottom drawers. */
  showHandle?: boolean
  /** Defaults to true for left and right drawers. */
  showCloseButton?: boolean
}) {
  const side = React.useContext(DrawerSideContext)
  const vertical = side === "top" || side === "bottom"
  const handle = showHandle ?? vertical
  const closeButton = showCloseButton ?? !vertical

  return (
    <DrawerPortal>
      {showBackdrop && <DrawerBackdrop />}
      <DrawerPrimitive.Viewport
        data-slot="drawer-viewport"
        className={cn(
          "fixed inset-0 z-[var(--hui-z-index-portal)] flex",
          viewportClasses[side]
        )}
      >
        <DrawerPrimitive.Popup
          data-slot="drawer-popup"
          data-side={side}
          data-close-button={closeButton ? "" : undefined}
          className={cn(
            "relative flex min-h-0 flex-col border-[var(--hui-color-border-overlay)] bg-[var(--hui-color-background-overlay)] text-[var(--hui-color-foreground-base-primary)] shadow-[var(--hui-shadow-floating)] outline-none",
            // Drags follow the pointer with no easing; the release settles
            // with the drawer curve, faster after a quick flick.
            "[transition:transform_var(--hui-duration-drawer)_var(--hui-ease-drawer),padding-bottom_var(--hui-duration-drawer)_var(--hui-ease-drawer),opacity_var(--hui-duration-drawer)_var(--hui-ease-drawer)] motion-safe:will-change-transform data-swiping:select-none data-swiping:[transition-duration:0ms] data-ending-style:[transition-duration:calc(var(--drawer-swipe-strength,1)*var(--hui-duration-drawer))]",
            // Reduced motion: no slide on open or close, only a short fade.
            "motion-reduce:[transition-duration:var(--hui-duration-fast)] motion-reduce:data-starting-style:opacity-0 motion-reduce:data-ending-style:opacity-0",
            "forced-colors:border-[CanvasText]",
            popupClasses[side],
            className
          )}
          {...props}
        >
          {handle && side === "bottom" && <DrawerHandle />}
          {/* Content scrolls here. Text inside stays selectable with a mouse. */}
          <DrawerPrimitive.Content
            data-slot="drawer-content"
            className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain touch-auto"
          >
            {children}
          </DrawerPrimitive.Content>
          {handle && side === "top" && <DrawerHandle />}
          {closeButton && (
            <DrawerPrimitive.Close className="absolute end-[10px] top-[14px] z-2 inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-[var(--hui-radius-2)] border border-transparent text-[var(--hui-color-foreground-base-secondary)] outline-none motion-safe:[transition:var(--hui-transition-interactive)] hover:bg-[var(--hui-color-background-overlay-hover)] hover:text-[var(--hui-color-foreground-base-primary)] focus-visible:[outline:var(--hui-focus-ring)] focus-visible:outline-offset-[var(--hui-focus-ring-offset-accent)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4">
              <XIcon />
              <span className="sr-only">Close</span>
            </DrawerPrimitive.Close>
          )}
        </DrawerPrimitive.Popup>
      </DrawerPrimitive.Viewport>
    </DrawerPortal>
  )
}

function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="drawer-header"
      className={cn(
        "flex flex-col gap-[var(--hui-space-2)] p-4 in-data-[side=bottom]:pt-1 in-data-[side=bottom]:text-center in-data-close-button:pe-11",
        className
      )}
      {...props}
    />
  )
}

function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="drawer-footer"
      className={cn(
        "sticky bottom-0 z-1 mt-auto flex flex-col gap-2 bg-[var(--hui-color-background-overlay)] p-4 *:w-full sm:flex-row sm:justify-end sm:*:w-auto in-data-[side=bottom]:sm:flex-col in-data-[side=bottom]:sm:*:w-full",
        className
      )}
      {...props}
    />
  )
}

function DrawerTitle({ className, ...props }: DrawerPrimitive.Title.Props) {
  return (
    <DrawerPrimitive.Title
      data-slot="drawer-title"
      className={cn(
        "m-0 text-[var(--hui-color-foreground-base-primary)] [font-size:var(--hui-font-size-large)] [font-weight:var(--hui-font-weight-medium)] [letter-spacing:var(--hui-letter-spacing-large)] [line-height:var(--hui-line-height-large)]",
        className
      )}
      {...props}
    />
  )
}

function DrawerDescription({
  className,
  ...props
}: DrawerPrimitive.Description.Props) {
  return (
    <DrawerPrimitive.Description
      data-slot="drawer-description"
      className={cn(
        "[font-size:var(--hui-font-size-control,13px)] [line-height:var(--hui-line-height-regular)] text-[var(--hui-color-foreground-base-secondary)]",
        className
      )}
      {...props}
    />
  )
}

export {
  Drawer,
  DrawerTrigger,
  DrawerPortal,
  DrawerClose,
  DrawerBackdrop,
  DrawerBackdrop as DrawerOverlay,
  DrawerPopup,
  DrawerPopup as DrawerContent,
  DrawerHandle,
  DrawerHeader,
  DrawerFooter,
  DrawerTitle,
  DrawerDescription,
}
export type { DrawerSide }

```

      
        Update the import paths to match your project setup.
      
    
  


## Usage [#usage]

```tsx
import {
  Drawer,
  DrawerClose,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerPopup,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/ui/drawer"
```

```tsx
<Drawer>
  <DrawerTrigger render={<Button variant="outline" />}>Open</DrawerTrigger>
  <DrawerPopup>
    <DrawerHeader>
      <DrawerTitle>Move to folder</DrawerTitle>
      <DrawerDescription>Choose where this file should live.</DrawerDescription>
    </DrawerHeader>
    {/* Body */}
    <DrawerFooter>
      <Button>Move</Button>
      <DrawerClose render={<Button variant="ghost" />}>Cancel</DrawerClose>
    </DrawerFooter>
  </DrawerPopup>
</Drawer>
```

```tsx
<Drawer snapPoints={["220px", 1]}>{/* ... */}</Drawer>
```

## Don't do this [#dont-do-this]

### A desktop side panel that nobody will swipe [#a-desktop-side-panel-that-nobody-will-swipe]

```tsx
// Bad
<Drawer side="right">{/* settings form on a desktop layout */}</Drawer>
```

```tsx
// Good
<Sheet>
  <SheetPopup side="right">{/* settings form */}</SheetPopup>
</Sheet>
```

On a desktop layout that people use with a mouse, gestures add nothing. They only add a way to drag a form shut by accident. Sheet gives the same surface with plain dialog behavior.

### Swiping as the only way out [#swiping-as-the-only-way-out]

```tsx
// Bad
<DrawerPopup showHandle>{/* a form with no cancel button */}</DrawerPopup>
```

```tsx
// Good
<DrawerFooter>
  <Button type="submit">Save</Button>
  <DrawerClose render={<Button variant="ghost" />}>Cancel</DrawerClose>
</DrawerFooter>
```

A handle shows that the panel can be dragged, but it doesn't say how to leave. Give every drawer that collects input a visible way to cancel.

## Examples [#examples]

### Snap points [#snap-points]

A compact summary that people can drag up to see every stop.

```tsx
"use client"

import * as React from "react"

import { Button } from "@/components/honest-ui/ui/button"
import {
  Drawer,
  DrawerDescription,
  DrawerHeader,
  DrawerPopup,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/honest-ui/ui/drawer"

// A short peek that shows the summary, then the full height of the screen.
const SNAP_POINTS = ["220px", 1]

const STOPS = [
  { time: "08:12", name: "Depot", detail: "Loaded 14 parcels" },
  { time: "08:40", name: "Market Street", detail: "3 parcels, signature required" },
  { time: "09:05", name: "Harbor Lofts", detail: "2 parcels, leave at concierge" },
  { time: "09:31", name: "Elm & 4th", detail: "1 parcel" },
  { time: "09:58", name: "Riverside Clinic", detail: "4 parcels, cold chain" },
  { time: "10:20", name: "Oak Terrace", detail: "2 parcels" },
  { time: "10:47", name: "North Library", detail: "1 parcel, returns pickup" },
  { time: "11:15", name: "Depot", detail: "End of route" },
]

export function DrawerSnapPoints() {
  const [snapPoint, setSnapPoint] = React.useState<string | number | null>(
    SNAP_POINTS[0]
  )

  return (
    <Drawer
      snapPoints={SNAP_POINTS}
      snapPoint={snapPoint}
      onSnapPointChange={setSnapPoint}
    >
      <DrawerTrigger
        render={(props) => (
          <Button {...props} variant="outline">
            View route
          </Button>
        )}
      />
      <DrawerPopup>
        <DrawerHeader>
          <DrawerTitle>Route 12 · 8 stops</DrawerTitle>
          <DrawerDescription>
            {snapPoint === 1
              ? "Drag down to return to the summary."
              : "Drag up to see every stop."}
          </DrawerDescription>
        </DrawerHeader>
        <ol className="m-0 flex list-none flex-col px-4 pb-4">
          {STOPS.map((stop, index) => (
            <li
              key={`${stop.name}-${index}`}
              className="flex gap-[var(--hui-space-4)] border-b-[0.5px] border-[var(--hui-color-border-overlay)] py-[var(--hui-space-3)] last:border-b-0"
            >
              <span className="w-12 shrink-0 text-[var(--hui-color-foreground-base-secondary)] tabular-nums [font-size:var(--hui-font-size-small)]">
                {stop.time}
              </span>
              <span className="flex flex-col gap-[var(--hui-space-1)]">
                <span className="[font-size:var(--hui-font-size-control,13px)] [font-weight:var(--hui-font-weight-medium)]">
                  {stop.name}
                </span>
                <span className="text-[var(--hui-color-foreground-base-secondary)] [font-size:var(--hui-font-size-small)]">
                  {stop.detail}
                </span>
              </span>
            </li>
          ))}
        </ol>
      </DrawerPopup>
    </Drawer>
  )
}

```

### Sides [#sides]

Each side swipes toward its own edge to dismiss.

```tsx
"use client"

import * as React from "react"

import { Button } from "@/components/honest-ui/ui/button"
import {
  Drawer,
  DrawerDescription,
  DrawerHeader,
  DrawerPopup,
  DrawerTitle,
  DrawerTrigger,
  type DrawerSide,
} from "@/components/honest-ui/ui/drawer"

const SIDES: DrawerSide[] = ["top", "right", "bottom", "left"]

export function DrawerSidePlacement() {
  return (
    <div className="grid grid-cols-2 gap-[var(--hui-space-3)]">
      {SIDES.map((side) => (
        <Drawer key={side} side={side}>
          <DrawerTrigger
            render={(props) => (
              <Button {...props} variant="outline" className="capitalize">
                {side}
              </Button>
            )}
          />
          <DrawerPopup>
            <DrawerHeader>
              <DrawerTitle className="capitalize">{side} drawer</DrawerTitle>
              <DrawerDescription>
                Swipe toward the {side} edge to dismiss it.
              </DrawerDescription>
            </DrawerHeader>
            <p className="m-0 px-4 pb-4 text-[var(--hui-color-foreground-base-secondary)] [font-size:var(--hui-font-size-control,13px)] [line-height:var(--hui-line-height-regular)]">
              The dismiss gesture always points back toward the edge the drawer
              came from, so the direction is predictable on every side.
            </p>
          </DrawerPopup>
        </Drawer>
      ))}
    </div>
  )
}

```

### Action sheet [#action-sheet]

Choices for one item, with the destructive action set apart from the list.

```tsx
"use client"

import * as React from "react"

import { Button } from "@/components/honest-ui/ui/button"
import {
  Drawer,
  DrawerClose,
  DrawerDescription,
  DrawerHeader,
  DrawerPopup,
  DrawerTitle,
  DrawerTrigger,
} from "@/components/honest-ui/ui/drawer"

const ACTIONS = ["Share link", "Duplicate", "Move to folder"]

export function DrawerActionSheet() {
  const [result, setResult] = React.useState("")

  return (
    <div className="flex flex-col items-center gap-[var(--hui-space-3)]">
      <Drawer>
        <DrawerTrigger
          render={(props) => (
            <Button {...props} variant="outline">
              Photo options
            </Button>
          )}
        />
        <DrawerPopup className="mx-auto max-w-md">
          <DrawerHeader>
            <DrawerTitle>IMG_2041.jpg</DrawerTitle>
            <DrawerDescription>Taken Oct 12 · 4.2 MB</DrawerDescription>
          </DrawerHeader>
          <div className="flex flex-col gap-[var(--hui-space-2)] px-4">
            {ACTIONS.map((action) => (
              <DrawerClose
                key={action}
                onClick={() => setResult(`${action} selected.`)}
                render={(props) => (
                  <Button {...props} variant="secondary" size="lg" className="w-full">
                    {action}
                  </Button>
                )}
              />
            ))}
          </div>
          {/* The destructive action is separated so a sloppy tap on the
              list above can never reach it. */}
          <div className="flex flex-col gap-[var(--hui-space-2)] p-4">
            <DrawerClose
              onClick={() => setResult("Photo moved to Recently deleted.")}
              render={(props) => (
                <Button {...props} variant="destructive-outline" size="lg" className="w-full">
                  Delete photo
                </Button>
              )}
            />
            <DrawerClose
              render={(props) => (
                <Button {...props} variant="ghost" size="lg" className="w-full">
                  Cancel
                </Button>
              )}
            />
          </div>
        </DrawerPopup>
      </Drawer>
      <p
        aria-live="polite"
        className="m-0 min-h-[var(--hui-space-5)] text-[var(--hui-color-foreground-base-secondary)] [font-size:var(--hui-font-size-small)]"
      >
        {result}
      </p>
    </div>
  )
}

```

## API reference [#api-reference]

All parts forward their matching Base UI Drawer props. `DrawerOverlay` aliases `DrawerBackdrop` and `DrawerContent` aliases `DrawerPopup`.

| Part                | Renders   | Notes                                                                    |
| ------------------- | --------- | ------------------------------------------------------------------------ |
| `Drawer`            | Root      | Open state, snap points, and `side`                                      |
| `DrawerTrigger`     | Button    | Opens the drawer                                                         |
| `DrawerPortal`      | Portal    | Mounts the drawer outside the layout tree                                |
| `DrawerBackdrop`    | Div       | Dims the page and fades with swipe progress                              |
| `DrawerPopup`       | Div       | The panel, with its viewport and scrollable content                      |
| `DrawerHandle`      | Div       | Decorative grab handle, rendered automatically on top and bottom drawers |
| `DrawerHeader`      | Div       | Title and description block                                              |
| `DrawerFooter`      | Div       | Actions pinned to the bottom of the panel                                |
| `DrawerTitle`       | Heading   | Names the drawer for assistive technology                                |
| `DrawerDescription` | Paragraph | Gives context for the task                                               |
| `DrawerClose`       | Button    | Closes the drawer                                                        |

`Drawer` adds:

| Prop                              | Values                           | Default  |
| --------------------------------- | -------------------------------- | -------- |
| `side`                            | `top`, `right`, `bottom`, `left` | `bottom` |
| `snapPoints`                      | `(number \| string)[]`           | —        |
| `snapPoint` / `onSnapPointChange` | Controlled snap point            | —        |

`side` sets the Base UI `swipeDirection` for you. `DrawerPopup` adds:

| Prop              | Values  | Default                   |
| ----------------- | ------- | ------------------------- |
| `showBackdrop`    | boolean | `true`                    |
| `showHandle`      | boolean | `true` for top and bottom |
| `showCloseButton` | boolean | `true` for left and right |

See the [Base UI Drawer API](https://base-ui.com/react/components/drawer#api-reference) for nested drawers, indent effects, and the swipe CSS variables.
