A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.
<script lang="ts"> import { Button, buttonVariants } from "$lib/components/ui/button/index.js"; import * as Dialog from "$lib/components/ui/dialog/index.js"; import { Input } from "$lib/components/ui/input/index.js"; import { Label } from "$lib/components/ui/label/index.js"; </script> <Dialog.Root> <Dialog.Trigger class={buttonVariants({ variant: "outline" })} >Edit Profile</Dialog.Trigger > <Dialog.Content class="sm:max-w-[425px]"> <Dialog.Header> <Dialog.Title>Edit profile</Dialog.Title> <Dialog.Description> Make changes to your profile here. Click save when you're done. </Dialog.Description> </Dialog.Header> <div class="grid gap-4 py-4"> <div class="grid grid-cols-4 items-center gap-4"> <Label for="name" class="text-right">Name</Label> <Input id="name" value="Pedro Duarte" class="col-span-3" /> </div> <div class="grid grid-cols-4 items-center gap-4"> <Label for="username" class="text-right">Username</Label> <Input id="username" value="@peduarte" class="col-span-3" /> </div> </div> <Dialog.Footer> <Button type="submit">Save changes</Button> </Dialog.Footer> </Dialog.Content> </Dialog.Root>
npx shadcn-svelte@latest add dialog
bits-ui
npm install bits-ui
<script lang="ts"> import * as Dialog from "$lib/components/ui/dialog"; </script> <Dialog.Root> <Dialog.Trigger>Open</Dialog.Trigger> <Dialog.Content> <Dialog.Header> <Dialog.Title>Are you sure absolutely sure?</Dialog.Title> <Dialog.Description> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </Dialog.Description> </Dialog.Header> </Dialog.Content> </Dialog.Root>
On This Page