Dialog

Dialogs inform users about a task and can contain critical information, require decisions, or involve multiple tasks.

tsx
'use client'

import {
	Button,
	Dialog,
	Input,
	Label,
	DialogTrigger,
	DialogContent,
	DialogHeader,
	DialogTitle,
	DialogDescription,
	DialogFooter,
} from '@nerdfish/ui'

export function DialogExample() {
	return (
		<Dialog>
			<DialogTrigger asChild>
				<Button variant="outline">Decorate Cake</Button>
			</DialogTrigger>
			<DialogContent className="sm:max-w-[425px]">
				<DialogHeader>
					<DialogTitle>Decorate your cake</DialogTitle>
					<DialogDescription>
						Make changes to your cake decorations here. Click save when
						you&apos;re done.
					</DialogDescription>
				</DialogHeader>
				<div className="gap-md py-md grid">
					<div className="gap-md grid grid-cols-4 items-center">
						<Label htmlFor="name" className="text-right">
							Cake Type
						</Label>
						<div className="col-span-3">
							<Input name="name" value="Chocolate Cake" />
						</div>
					</div>
					<div className="gap-md grid grid-cols-4 items-center">
						<Label htmlFor="username" className="text-right">
							Cake Topper
						</Label>
						<div className="col-span-3">
							<Input name="name" value="Happy Birthday" />
						</div>
					</div>
				</div>
				<DialogFooter>
					<Button type="submit">Save decorations</Button>
				</DialogFooter>
			</DialogContent>
		</Dialog>
	)
}

Usage

tsx
import {
	Dialog,
	DialogTrigger,
	DialogContent,
	DialogHeader,
	DialogTitle,
	DialogDescription,
} from '@nerdfish/ui'
tsx
<Dialog>
	<DialogTrigger>Remove order</DialogTrigger>
	<DialogContent>
		<DialogHeader>
			<DialogTitle>Are you sure absolutely sure?</DialogTitle>
			<DialogDescription>
				This action cannot be undone. This will permanently delete your cake
				order and remove your dessert from our kitchen.
			</DialogDescription>
		</DialogHeader>
	</DialogContent>
</Dialog>