Controls

Dialog

Preview
Reduced motion

Simulates prefers-reduced-motion for the demo. Off follows your system setting.

Keyboard stepping

Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.

Dialog

Dialog

A modal window that unfolds out of the button that opened it.

Installation

npx shadcn@latest add ikislay/pixel-ui/dialog

How to use

import { Dialog } from "@/components/ui/dialog"
export function Demo() {
return (
<Dialog
title="Invite people"
description="They will get an email with a link."
trigger={<button type="button">Invite</button>}
>
<input type="email" placeholder="[email protected]" aria-label="Email" />
</Dialog>
)
}

Source Code

// Loading…

Props

Options you can pass to customize this component.

Prop
Type
Description
title*
ReactNode

The heading. It also names the dialog for screen readers.

description
ReactNode

A line under the title, read out when the dialog opens.

trigger
ReactElement

An element that opens the dialog. Leave it out when you control open yourself.

open
boolean

Controls the dialog. Leave it unset to let the dialog manage itself.

defaultOpen
boolean

The starting state when uncontrolled.

onOpenChange
(open: boolean) => void

Called whenever the dialog opens or closes.

onFeedback
(event: "open" | "close") => void

Called at each semantic moment, for wiring sound or haptics.

className
string

Merged onto the window.