Alpha EnhancementReact 18 & 19Zero Runtime CSS

Dialog

A controlled native modal, with focus managed by the browser and an honest inline fallback.

Interactive preview

Workspace settings

A native dialog with familiar controls.

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:

PropTypeDefaultDescription
openbooleanrequiredControlled visibility.
onOpenChange(open: boolean) => voidrequiredVisibility requests from close, Escape or native forms.
titleReactNoderequiredVisible accessible title.
descriptionReactNode—Optional supporting description.
returnFocusRefRefObject<HTMLElement | null>native invokerExplicit focus return target for pointer triggers, including Safari.
initialFocusRefRefObject<HTMLElement | null>native first controlPreferred initial focus target.
closeLabelstringClose dialogLocalize 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 dialog

Make 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.

Dialog.tsxREACT / TSX

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.