Dialog

A modal dialog that interrupts the user with important content.

Loading preview…

Installation

Usage

Use dialog for modal confirmation and focused tasks. Compose with trigger, content, header, and footer.

1<script lang="ts">
2	import * as Dialog from '~/components/dialog';
3	import { Button, buttonVariants } from '~/components/button';
4</script>
5
6<Dialog.Root>
7	<form>
8		<Dialog.Trigger type="button" class={buttonVariants({ variant: 'outline' })}>
9			Open Dialog
10		</Dialog.Trigger>
11		<Dialog.Content class="sm:max-w-[425px]">
12			<Dialog.Header>
13				<Dialog.Title>Edit profile</Dialog.Title>
14				<Dialog.Description>
15					Make changes to your profile here. Click save when you're done.
16				</Dialog.Description>
17			</Dialog.Header>
18			<Dialog.Footer>
19				<Dialog.Close type="button" class={buttonVariants({ variant: 'outline' })}>
20					Cancel
21				</Dialog.Close>
22				<Button type="submit">Save changes</Button>
23			</Dialog.Footer>
24		</Dialog.Content>
25	</form>
26</Dialog.Root>