# Drawer

Slide-in panel from any edge



<ComponentPreview base="opentui" name="drawer-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/opentui-drawer
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="opentui" name="drawer" title="components/ui/drawer.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { Drawer } from "@/components/ui/drawer";
```

```tsx
<Drawer
  isOpen={true}
  edge="right"
  title="Details"
  width={40}
  onClose={() => close()}
>
  <Text>Name: my-project</Text>
  <Text>Status: active</Text>
</Drawer>
```

API Reference [#api-reference]

Drawer [#drawer]

| Prop       | Type                                     | Default    |
| ---------- | ---------------------------------------- | ---------- |
| `isOpen`   | `boolean`                                | `false`    |
| `edge`     | `"left" \| "right" \| "top" \| "bottom"` | `"right"`  |
| `title`    | `string`                                 | -          |
| `children` | `ReactNode`                              | `required` |
| `onClose`  | `() => void`                             | -          |
| `width`    | `number`                                 | `40`       |
| `height`   | `number`                                 | `10`       |
