# Dialog

> Wraps `DialogPrimitive.Root` so focus is restored on close even when the dialog is opened in a controlled way, without its own `DialogTrigger`.

Source: https://ui.jcsoftdev.com/docs/components/dialog

Wraps `DialogPrimitive.Root` so focus is restored on close even when the
dialog is opened in a controlled way, without its own `DialogTrigger`.

## Import

```ts
import { Dialog } from "@jcsoftdev/ui/overlays";
```

Single-component entry points tree-shake to just this component: `@jcsoftdev/ui/overlays/dialog`.

## Usage

```tsx
export const Default: Story = {
  render: (args) => (
    <Dialog>
      <DialogTrigger asChild>
        <Button variant="danger">Anular cita</Button>
      </DialogTrigger>
      <DialogContent {...args}>
        <CancelBody />
      </DialogContent>
    </Dialog>
  ),
};
```

_Source of the Storybook story._

## Props

This component declares no props of its own.

It also accepts the native props of the element or primitive it renders (for example `className`, `id`, `aria-*` and event handlers).

## Storybook stories

- [Default](/storybook/?path=/story/overlays-dialog--default)
- [Open By Default](/storybook/?path=/story/overlays-dialog--open-by-default)
- [Large](/storybook/?path=/story/overlays-dialog--large)
- [Blocking](/storybook/?path=/story/overlays-dialog--blocking)
- [Controlled](/storybook/?path=/story/overlays-dialog--controlled)
- [In Scoped Container](/storybook/?path=/story/overlays-dialog--in-scoped-container)
- [In Scoped Preset](/storybook/?path=/story/overlays-dialog--in-scoped-preset)

## Source

`packages/ui/src/overlays/dialog/dialog.tsx`
