Skip to content

Dialog

A focused surface for decisions that need attention.

ModalOverlay
npx shadcn@latest add @silicon-ui/dialog

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/dialog

Manually

  1. Install the dependencies

    npm install @radix-ui/react-dialog lucide-react motion
  2. Copy these files into your project

    • components/silicon-ui/dialog/dialog.tsx
    • components/silicon-ui/dialog/dialog.module.css

    Shared with other components. Skip any you already have.

    • components/silicon-ui/lib/escape.ts
    • components/silicon-ui/lib/return-focus.ts
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { Dialog } from "@/components/silicon-ui/dialog/dialog";

API reference

Dialog

Accepts the props of DialogProps.

DialogContent

PropTypeDefault
title*string—
children*ReactNode—
description

Plain text swaps in with a rise when it changes; markup (a bold id) is shown as given.

ReactNode—
hideHeader

Keep the title and optional description available to assistive technology without drawing a header or close button.

booleanfalse
placement

Place the dialog near the top of the viewport; centered by default.

"center" | "top""center"

Also accepts the props of ComponentPropsWithoutRef<typeof DialogPrimitive.Content>.

DialogTrigger

Accepts the props of ButtonHTMLAttributes.

DialogClose

Accepts the props of ButtonHTMLAttributes.

Dependencies

npm
@radix-ui/react-dialoglucide-reactmotion
Registry
silicon-motion-tokens