Dialog
interlace-ui/dialogFreeComponent
A MODAL dialog: it traps focus, dismisses on Escape and on an outside click, marks the rest of the page inert while open, and restores focus to the trigger on close. Base UI owns all of that, which is exactly why this file never says so anywhere else — and…
Install it
npx shadcn@latest add https://ds.interlace.tools/r/dialog.jsonSource
1'use client';23import * as React from 'react';45// @interlace/dialog v1.4.0 — Interlace design system.6// Docs, props and live preview: https://ds.interlace.tools/c/dialog7// What changed since: https://ds.interlace.tools/c/dialog#history8// Generated banner — keep it, the upgrade diff reads this version.910/**11 * @interlace/ui — Dialog (gold-standard reference for the interlace-component skill)12 *13 * A MODAL dialog: it traps focus, dismisses on Escape and on an outside click,14 * marks the rest of the page inert while open, and restores focus to the15 * trigger on close. Base UI owns all of that, which is exactly why this file16 * never says so anywhere else — and why a reader searching for "modal I can17 * close with escape" could not find it. Behaviour a consumer relies on has to18 * be written down in the file they install, not left implicit in a dependency.19 *20 * This file is the canonical example of the portable component-modeling floor.21 * Every rule R1–R26 from `skills/interlace-component/SKILL.md` that is applicable22 * to a Dialog primitive is illustrated here.23 *24 * | Rule | Concept | Where in this file |25 * | ---- | -------------------------------- | ------------------------------------------------------------- |26 * | R4 | Extends native el + JSDoc | `React.ComponentProps<typeof BaseDialog.*>` on every export |27 * | R5 | data-testid type-required | Inherited via consumer-supplied `data-testid` on `...props` |28 * | R6 | data-slot on every named part | `data-slot="dialog"` / `"dialog-trigger"` / `"dialog-portal"` / `"dialog-close"` / `"dialog-overlay"` / `"dialog-popup"` |29 * | R7 | className merged + ...rest + ref | `cn(...)` merged className; `{...props}` spread to root |30 * | R8 | No `isXxx` prefix on booleans | All boolean props inherited from Base UI use the no-`is` form |31 * | R11 | Composition over prop-drilling | DialogContent / DialogHeader / DialogFooter / DialogTitle / DialogDescription compound parts |32 * | R12 | Reuse primitives — don't wrap | XIcon from lucide-react is slotted, not wrapped in a `DialogCloseIcon` |33 * | R13 | Build with the ecosystem | `@base-ui/react/dialog` provides keyboard / focus / portal / ARIA |34 * | R14 | Controlled + uncontrolled | Inherited from `BaseDialog.Root` — `open` + `onOpenChange` + `defaultOpen` |35// … truncated
More from interlace-ui
All 140 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| A11y Startera11y-starter | interlace-ui | Components | Free | no deps | |
| Accordionaccordion | interlace-ui | Components | Free | no deps | |
| Alertalert | interlace-ui | Components | Free | no deps | |
| Alert Dialogalert-dialog | interlace-ui | Components | Free | no deps | |
| Animated Gradient Textanimated-gradient-text | interlace-ui | Components | Free | no deps | |
| Animated Grid Patternanimated-grid-pattern | interlace-ui | Components | Free | no deps | |
| Animated Listanimated-list | interlace-ui | Components | Free | no deps | |
| Article Cardarticle-card | interlace-ui | Components | Free | no deps |
