--- url: /reference/items/Dialog/examples.md --- # Examples ## Modal dialog Click the Open dialog button to open a modal wired entirely with [`Action`](/reference/items/Action/). The backdrop fades and the box scales in, each a [`Transition`](/reference/items/Transition/) child the `Dialog` orchestrates. Close it with the button, the backdrop, or Esc. :::code-group ```js import { registerComponent } from '@studiometa/js-toolkit'; import { Action, Dialog, Transition } from '@studiometa/ui'; registerComponent(Action); registerComponent(Dialog); registerComponent(Transition); ``` ::: ## Drawer A drawer is just a `Dialog`. The panel is anchored to the right edge with plain classes (`absolute inset-y-0 right-0 w-80`) and slides in via an optional [`ViewTransition`](/reference/items/ViewTransition/) child, which stays smooth even in Firefox. Both the position and the slide direction are author-controlled; the library ships no drawer component. See [Building a drawer](./index.md#building-a-drawer). :::code-group ```js import { registerComponent } from '@studiometa/js-toolkit'; import { Action, Dialog, ViewTransition } from '@studiometa/ui'; registerComponent(Action); registerComponent(Dialog); registerComponent(ViewTransition); ``` :::