Overlays / Dialog

Dialog

Focus a short task in a modal layer.

Customize

Props · 6

PropDefaultDescription
modalbooleantrueDims the page with a scrim, traps focus, locks scroll and blocks clicks outside. Off: no scrim, the page stays usable.
disablePointerDismissalbooleanfalseIgnore clicks outside; close with Escape or a button.
DialogContent.showCloseButtonbooleantrueCorner close button.
DialogTrigger.childrenstring"Open dialog"Trigger label.
DialogTitle.childrenstring"Packet details"Heading, also the accessible name.
DialogDescription.childrenstring"Focus stays inside until you close this view."Supporting text, also the accessible description.

Usage

import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose } from "@/components/ui/dialog"
import { Button } from "@/components/ui/button"

<Dialog>
  <DialogTrigger render={<Button variant="secondary" />}>Open dialog</DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>Packet details</DialogTitle>
      <DialogDescription>Focus stays inside until you close this view.</DialogDescription>
    </DialogHeader>
    <DialogFooter>
      <DialogClose render={<Button variant="secondary" />}>Close</DialogClose>
      <Button recipe="press-key">Confirm</Button>
    </DialogFooter>
  </DialogContent>
</Dialog>

Install

Paste this prompt into your coding agent. It installs through the registry and adds the 1bitcn rules to AGENTS.md.

Install Dialog from 1bitcn (@1bitcn/dialog) in this project.

1bitcn is a shadcn registry of 1-bit React components. Every theme has exactly two paints: ink and paper.

1. If the project has no components.json, run `npx shadcn@latest init` first.
2. Add the registry: `npx shadcn@latest registry add @1bitcn=https://1bitcn.com/r/{name}.json`
3. Install: `npx shadcn@latest add @1bitcn/dialog` (it also brings @1bitcn/base: theme, CSS and the agent skill). If the project uses another package runner (pnpm dlx, yarn dlx, bunx), you may use it instead. Do not copy files by hand.
4. Add this note to AGENTS.md (create the file if needed; skip if it is already there):

   ## 1bitcn
   - UI comes from the 1bitcn shadcn registry (@1bitcn). Catalog: https://1bitcn.com/llms.txt. Full rules: .agents/skills/1bitcn/SKILL.md
   - Each theme has two paints, ink and paper. Middle tones come from the monochrome ramp tokens (--bit-ink-soft, --bit-mid, --bit-paper-deep, --bit-scrim). Add no other colors.
   - Show state with shape, border, pattern or label, not hue. Add items with `shadcn add @1bitcn/<name>`, not by hand.
5. Use it with this configuration. If it is unclear where it belongs, ask before editing:

   ```tsx
   import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose } from "@/components/ui/dialog"
   import { Button } from "@/components/ui/button"
   
   <Dialog>
     <DialogTrigger render={<Button variant="secondary" />}>Open dialog</DialogTrigger>
     <DialogContent>
       <DialogHeader>
         <DialogTitle>Packet details</DialogTitle>
         <DialogDescription>Focus stays inside until you close this view.</DialogDescription>
       </DialogHeader>
       <DialogFooter>
         <DialogClose render={<Button variant="secondary" />}>Close</DialogClose>
         <Button recipe="press-key">Confirm</Button>
       </DialogFooter>
     </DialogContent>
   </Dialog>
   ```
6. Check: the project typechecks and builds, and the component from `@/components/ui/dialog` renders.

Docs: https://1bitcn.com/docs/components/dialog.md
Include source

Optional: let your agent browse the registry with npx shadcn@latest mcp init.

States

In use
Keyboard

Tab moves through the active layer. Escape closes supported overlays and returns focus to their trigger.

Motion engine

Loading motion options…

Source