---
title: Drawer
description: A draggable dialog that is attached to any side of the viewport.

link:
  doc: https://corvu.dev/docs/primitives/drawer
  api: https://corvu.dev/docs/primitives/drawer/#api-reference
---

<ComponentPreview name="drawer-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/drawer-demo.tsx

```

</ComponentPreview>

## Installation

<ComponentInstallation>

<Step>

<StepItem>Copy and paste the following code into your project:</StepItem>

  <ComponentSourceTabs>

    ```tsx title="components/ui/drawer" file=<rootDir>/apps/docs/src/registry/ui/drawer.tsx

    ```

    ```tsx title="components/ui/drawer" file=<rootDir>/apps/unocss-playground/src/registry/ui/drawer.tsx

    ```

  </ComponentSourceTabs>

</Step>

</ComponentInstallation>

## Usage

```tsx
import {
  Drawer,
  DrawerContent,
  DrawerDescription,
  DrawerHeader,
  DrawerPortal,
  DrawerTitle,
  DrawerTrigger,
} from "@components/ui/drawer"
```

```tsx
<Drawer>
  <DrawerTrigger />
  <DrawerPortal>
    <DrawerContent>
      <DrawerHeader>
        <DrawerTitle />
        <DrawerDescription />
      </DrawerHeader>
    </DrawerContent>
  </DrawerPortal>
</Drawer>
```

## Examples

### Side

<ComponentPreview name="drawer-side-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/drawer-side-demo.tsx

```

</ComponentPreview>
