# Dialog

A named native modal dialog with inert background and managed focus.

Connect Flood once using [the installation guide](https://flood.md/docs/installation). Then import the components you use; no per-component add command is needed.

## Example

```tsx
"use client";

import { FloodRoot, Dialog, Button } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <Dialog title="Create a project" trigger={trigger => <Button {...trigger}>Open dialog</Button>}>Project details.</Dialog>
    </FloodRoot>
  );
}
```

## Design notes

- Uses native showModal, not a simulated modal div.
- Escape closes the top layer; outside closing can be disabled independently. Tab remains inside the dialog.
- Closed content unmounts. Forward trigger props/ref; initialFocusRef can select a safe initial control. Modern native dialog support is required.

## API reference

| Prop | Values | Default |
| --- | --- | --- |
| `title` | `string` | `Required` |
| `description` | `string` | `—` |
| `trigger` | `(props: OverlayTriggerProps) => ReactNode` | `Required` |
| `children` | `ReactNode` | `—` |
| `open` | `boolean` | `—` |
| `defaultOpen` | `boolean` | `false` |
| `onOpenChange` | `(open: boolean) => void` | `—` |
| `disabled` | `boolean` | `false` |
| `closeLabel` | `string` | `"Close"` |
| `closeOnOutsideClick` | `boolean` | `true` |
| `initialFocusRef` | `RefObject<HTMLElement \| null>` | `—` |
| `Native HTML props` | `Omit<HTMLAttributes<HTMLDialogElement>, "children" \| "title" \| "role">` | `Forwarded` |
