Skip to content
v0.2.10

Dialog

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

Preview

Create a project

A calm space for the next idea.

Use Dialog

Dialog is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
dialog.tsxTSX
"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

PropValuesDefault
titlestringRequired
descriptionstring—
trigger(props: OverlayTriggerProps) => ReactNodeRequired
childrenReactNode—
openboolean—
defaultOpenbooleanfalse
onOpenChange(open: boolean) => void—
disabledbooleanfalse
closeLabelstring"Close"
closeOnOutsideClickbooleantrue
initialFocusRefRefObject<HTMLElement | null>—
Native HTML propsOmit<HTMLAttributes<HTMLDialogElement>, "children" | "title" | "role">Forwarded
View TypeScript source