Dialog
A modal that requires a title, plus a confirm dialog that can ask you to type the name.
- Category
- Overlays
- Access
- Free with an account
- Source
- 266 lines · one file
The decision inside it
Clicking the backdrop does not destroy a form
A dialog holding typed input closes on Escape or the button, not on a stray click outside it.
When to use it
Use Dialog for a focused task over the page; DialogContent requires a title (it can be visually hidden). ConfirmDialog is the ready-made "are you sure" with an async confirm and an optional type-to-confirm word.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Dialog for this.
Install it: npx shadcn@latest add @liro/dialog
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/dialog.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { Button } from "@/components/ui/button";
import { ConfirmDialog, Dialog, DialogContent, DialogFooter, DialogTrigger } from "@/components/ui/dialog";
export function DeleteProject({ remove }: { remove: () => Promise<void> }) {
return (
<div className="flex gap-2">
<Dialog>
<DialogTrigger asChild>
<Button variant="outline">Rename</Button>
</DialogTrigger>
<DialogContent title="Rename project" description="Everyone in the workspace sees the new name.">
<DialogFooter>
<Button>Save</Button>
</DialogFooter>
</DialogContent>
</Dialog>
<ConfirmDialog
trigger={<Button variant="destructive">Delete</Button>}
title="Delete Q4 plan?"
description="This removes every file in it."
actionLabel="Delete project"
destructive
confirmText="Q4 plan"
onConfirm={remove}
/>
</div>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
title | React.ReactNode | Yes | Rendered as the dialog's accessible name. Required — use `hideTitle` if the design has no visible title. |
description | React.ReactNode | No | One or two sentences: what happens, and what it affects. |
hideTitle | boolean | No | Keep the title for screen readers only. |
size | keyof typeof WIDTH | No | – |
showClose | boolean | No | Show the × in the corner. Default true. |
inline | boolean | No | – |
Dependencies
npm packages
@radix-ui/react-dialogclsxlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themebuttonAccessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances