# dialog.drawer

A full-height panel that slides in from the side over the dimmed page: site navigation on a small screen. A click outside closes it

Component: [`<Dialog>`](https://www.prongs.dev/docs/components/dialog.md) · Renders: `<dialog>` · Profile: [UI](https://www.prongs.dev/docs/intents/ui.md)

## Example

```tsx
<Dialog intent="dialog.drawer" open={open} onClose={() => setOpen(false)} label="Title">
  …
</Dialog>
```

## Choosing between neighbours

Find the row that describes your element, and use the intent on the right.

| If it is for… | Use |
|---|---|
| A full-height panel that slides in from the side over the dimmed page: site navigation on a small screen. A click outside closes it | `dialog.drawer` (this page) |
| A task to finish before going back to the page | [`dialog.task`](https://www.prongs.dev/docs/intents/dialog/task.md) |
| One piece of content over the whole screen | [`dialog.reader`](https://www.prongs.dev/docs/intents/dialog/reader.md) |

## Connections

Declared in the registry, both directions. Where an intent is used in your own code is something check and the gallery see; this site has no app code.

- Built from: [`surface.overlay`](https://www.prongs.dev/docs/intents/ui.md#surface-overlay)

## For registry authors

**Starter intents.** These are the intents `prongs add` puts in your registry, shown in this site’s theme. Yours are your own `registry.ts`: rename, restyle and add to them, and see them with `prongs add gallery`.

What this intent is built from and its entry in `components/prongs/registry.ts`. You only need this to change how it looks or to add an intent like it.

How dialog.drawer resolves, and its definition

Each layer adds to the one before it; a later class wins over an earlier one that sets the same thing.

- [`surface.overlay`](https://www.prongs.dev/docs/intents/ui.md#surface-overlay) — Floats over a dimmed page and starts its own stack of surfaces

  ```
  surface-overlay m-auto rounded-lg border border-surface-border
  shadow-xl backdrop:bg-black/50
  ```

- `dialog.drawer` (this page) — A full-height panel that slides in from the side over the dimmed page: site navigation on a small screen. A click outside closes it

  ```
  my-0 ml-0 h-full max-h-none w-[min(20rem,calc(100%-3rem))]
  max-w-none overflow-y-auto rounded-none border-y-0 border-l-0
  px-4 py-6 transition-[translate] duration-200 ease-out
  starting:-translate-x-full motion-reduce:transition-none
  ```

Final classes

```
surface-overlay m-auto border border-surface-border shadow-xl
backdrop:bg-black/50 my-0 ml-0 h-full max-h-none
w-[min(20rem,calc(100%-3rem))] max-w-none overflow-y-auto
rounded-none border-y-0 border-l-0 px-4 py-6
transition-[translate] duration-200 ease-out
starting:-translate-x-full motion-reduce:transition-none
```

Definition

```ts
'dialog.drawer': {
  kind: 'semantic',
  description: 'A full-height panel that slides in from the side over the dimmed page: site navigation on a small screen. A click outside closes it',
  refs: ['surface.overlay'],
  binding: {
    classes: 'my-0 ml-0 h-full max-h-none w-[min(20rem,calc(100%-3rem))] max-w-none overflow-y-auto rounded-none border-y-0 border-l-0 px-4 py-6 transition-[translate] duration-200 ease-out starting:-translate-x-full motion-reduce:transition-none',
  },
  notFor: [
    {
      context: 'a task to finish before going back to the page',
      instead: 'dialog.task',
    },
    {
      context: 'one piece of content over the whole screen',
      instead: 'dialog.reader',
    },
  ],
},
```
