# Drawer (Andromeda Legacy)

Drawer is a component of the free, MIT-licensed Andromeda Legacy design system from AI Canvas (https://aicanvas.me). Index of every system, component and install setup: https://aicanvas.me/llms.txt

Slide-in panel on any side (left, right, top, or bottom), with focus trap and a size prop. Backdrop, ESC to close, body scroll lock, and the bracket motif. Portaled.

- Design system: [Andromeda Legacy](https://aicanvas.me/design-systems/andromeda.md)
- License: MIT
- Install slug: `andromeda-drawer`
- Page: https://aicanvas.me/design-systems/andromeda/drawer

## Install

```bash
npx shadcn@latest add @aicanvas/andromeda-drawer
```

Needs a free AI Canvas account; signed out, the command writes a placeholder (an `AccountRequired` notice) instead.

Every Andromeda Legacy component at once: `npx shadcn@latest add @aicanvas/andromeda`.

Token setup: the Install section of https://aicanvas.me/llms.txt.

## Use it

It installs to `components/aicanvas/andromeda/components/Drawer.tsx` (under `src/` if your project has one). With the usual `@/` alias:

```tsx
import { Drawer } from '@/components/aicanvas/andromeda/components/Drawer'
```

## Example

```tsx
import { useState } from 'react'
import { Drawer, DrawerBody, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle } from '@/components/aicanvas/andromeda/components/Drawer'
import { Button } from '@/components/aicanvas/andromeda/components/Button'

const [open, setOpen] = useState(false);

<>
  <Button onClick={() => setOpen(true)}>Review deploy</Button>
  <Drawer open={open} onOpenChange={setOpen} side="right">
    <DrawerHeader>
      <DrawerTitle>Deploy changes</DrawerTitle>
      <DrawerDescription>Review the production release.</DrawerDescription>
    </DrawerHeader>
    <DrawerBody><p>Version 2.4 includes three approved changes.</p></DrawerBody>
    <DrawerFooter>
      <Button onClick={() => setOpen(false)}>Confirm deploy</Button>
    </DrawerFooter>
  </Drawer>
</>
```

## Variants

- `side`: left, right, top or bottom (default 'right')

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open` | `boolean` |  | Whether the drawer is open. |
| `onOpenChange?` | `(next: boolean) => void` |  | Handler called with the next open state when the drawer requests to close (ESC or backdrop click). |
| `side?` | `'left'\|'right'\|'top'\|'bottom'` | `'right'` | Screen edge the panel slides in from. |
| `size?` | `number\|string` | `420` | Width (left/right) or height (top/bottom). Number → px, string passed through. |
| `children?` | `React.ReactNode` |  | Panel content, typically the Drawer compound parts (Header, Body, Footer). |
| `className?` | `string` |  | Extra classes merged onto the panel element. |
| `style?` | `React.CSSProperties` |  | Inline styles merged onto the panel element. |

## More Andromeda Legacy components

- [Empty State](https://aicanvas.me/design-systems/andromeda/empty-state.md)
- [Gauge](https://aicanvas.me/design-systems/andromeda/gauge.md)
- [Heat Grid](https://aicanvas.me/design-systems/andromeda/heat-grid.md)
- [Icon Button](https://aicanvas.me/design-systems/andromeda/icon-button.md)
- [Input](https://aicanvas.me/design-systems/andromeda/input.md)
