Dialog

A React modal dialog on Base UI with default, confirmation, form, fullscreen, and scrollable layouts, focus trapping, and a ready made confirm flow.

Loading preview

Examples

Practical examples and common states for the same installable component.

Default

Standard centered modal for everyday settings and edits.

examples/dialog-default.tsx
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/wensity/dialog";
export function DefaultDialog() {
return (
<Dialog>
<DialogTrigger>Open</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Notification preferences</DialogTitle>
</DialogHeader>
</DialogContent>
</Dialog>
);
}

Confirmation

Destructive or high-stakes actions with icon and dual CTAs.

Requires: button

examples/dialog-confirmation.tsx
import { DialogConfirmation } from "@/components/wensity/dialog";
import { Button } from "@/components/wensity/button";
export function ConfirmationDialog() {
return (
<DialogConfirmation
trigger={<Button variant="destructive">Delete</Button>}
title="Delete this item?"
description="This cannot be undone."
confirmLabel="Delete"
destructive
/>
);
}

Form

Wider layout optimized for multi-field input flows.

examples/dialog-form.tsx
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/wensity/dialog";
export function FormDialog() {
return (
<Dialog>
<DialogTrigger>Invite</DialogTrigger>
<DialogContent variant="form">
<DialogHeader>
<DialogTitle>Invite teammate</DialogTitle>
</DialogHeader>
</DialogContent>
</Dialog>
);
}

Fullscreen

Edge-to-edge modal for immersive editing experiences.

examples/dialog-fullscreen.tsx
import { Dialog, DialogContent, DialogTrigger } from "@/components/wensity/dialog";
export function FullscreenDialog() {
return (
<Dialog>
<DialogTrigger>Open editor</DialogTrigger>
<DialogContent variant="fullscreen" />
</Dialog>
);
}

Scrollable

Sticky header and footer with a scrolling body region.

examples/dialog-scrollable.tsx
import { Dialog, DialogContent, DialogScrollBody, DialogTrigger } from "@/components/wensity/dialog";
export function ScrollableDialog() {
return (
<Dialog>
<DialogTrigger>Browse</DialogTrigger>
<DialogContent variant="scrollable">
<DialogScrollBody>{/* long list */}</DialogScrollBody>
</DialogContent>
</Dialog>
);
}

Overview

Dialog is a React and Tailwind CSS modal dialog on Base UI, in Next.js or any React app, with default, confirmation, form, fullscreen, and scrollable layouts. Focus moves into the dialog and stays there until it closes, Escape and the close button dismiss it, and the page behind sits under a backdrop. If you forget a DialogTitle, an invisible one is added from accessibilityTitle so screen readers still announce something. DialogConfirmation packages the common are you sure flow with cancel and confirm buttons and a destructive style. DialogTrigger with asChild keeps your own button as the opener.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add dialog

Usage

Import Dialog from @/components/wensity/dialog and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/wensity/dialog";
export function DialogDemo() {
return (
<Dialog>
<DialogTrigger>Open</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Title</DialogTitle>
<DialogDescription>Description</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>
);
}

Props

PropTypeDefaultDescription
openboolean-Controlled open state.
defaultOpenboolean-Initial open state when uncontrolled.
onOpenChange(open: boolean) => void-Called when the dialog opens or closes.
modalbooleantrueTraps focus and blocks interaction with the page behind.
  • Genie Effect component preview

    Genie Effect

    A macOS genie minimize built on a real per-slice warp that sucks any window, folder, or panel down into a waiting dock.

  • Refraction Glass Container component preview

    Refraction Glass Container

    Real refraction, where feDisplacementMap warps the actual pixels sitting behind the card instead of blurring them.

  • Dynamic Island Toast component preview

    Dynamic Island Toast

    A pixel-faithful Apple Dynamic Island that morphs, splits, and breathes while it hosts live activities inside your app.

  • Peel Effect component preview

    Peel Effect

    Grab any corner and peel the sheet back. It curls, catches the light, and springs shut with the weight of paper.