Dialog
A controlled native modal, with focus managed by the browser and an honest inline fallback.
Interactive preview
Usage
import { Dialog, Button } from "@devvy-ui/react";
<Dialog open={open} onOpenChange={setOpen}
title="Workspace settings" description="Make it yours.">
<Button onClick={() => setOpen(false)}>Done</Button>
</Dialog>API reference
Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | required | Controlled visibility. |
| onOpenChange | (open: boolean) => void | required | Visibility requests from close, Escape or native forms. |
| title | ReactNode | required | Visible accessible title. |
| description | ReactNode | — | Optional supporting description. |
| returnFocusRef | RefObject<HTMLElement | null> | native invoker | Explicit focus return target for pointer triggers, including Safari. |
| initialFocusRef | RefObject<HTMLElement | null> | native first control | Preferred initial focus target. |
| closeLabel | string | Close dialog | Localize the close button. |
Accessibility & behavior
Platform Behavior & Guidelines
Use a stateful client component. The native modal provides inert background, focus containment, Escape and focus return. SSR markup remains closed until hydration. Without showModal support it renders a named, nonmodal inline panel. A visible close button is always included.
Source ownership
Add the audited implementation directly into your repository with the CLI:
node /path/to/devvy-ui/packages/cli/src/cli.mjs add dialogMake the source yours.
Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.
Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.