shadcn-svelte for Svelte 5 has been released! - Visit the preview docs
A modal dialog that interrupts the user with important content and expects a response.
<script lang="ts"> import * as AlertDialog from "$lib/components/ui/alert-dialog/index.js"; import { Button } from "$lib/components/ui/button/index.js"; </script> <AlertDialog.Root> <AlertDialog.Trigger asChild let:builder> <Button builders={[builder]} variant="outline">Show Dialog</Button> </AlertDialog.Trigger> <AlertDialog.Content> <AlertDialog.Header> <AlertDialog.Title>Are you absolutely sure?</AlertDialog.Title> <AlertDialog.Description> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </AlertDialog.Description> </AlertDialog.Header> <AlertDialog.Footer> <AlertDialog.Cancel>Cancel</AlertDialog.Cancel> <AlertDialog.Action>Continue</AlertDialog.Action> </AlertDialog.Footer> </AlertDialog.Content> </AlertDialog.Root>
npx shadcn-svelte@latest add alert-dialog
<script lang="ts"> import * as AlertDialog from "$lib/components/ui/alert-dialog"; </script> <AlertDialog.Root> <AlertDialog.Trigger>Open</AlertDialog.Trigger> <AlertDialog.Content> <AlertDialog.Header> <AlertDialog.Title>Are you absolutely sure?</AlertDialog.Title> <AlertDialog.Description> This action cannot be undone. This will permanently delete your account and remove your data from our servers. </AlertDialog.Description> </AlertDialog.Header> <AlertDialog.Footer> <AlertDialog.Cancel>Cancel</AlertDialog.Cancel> <AlertDialog.Action>Continue</AlertDialog.Action> </AlertDialog.Footer> </AlertDialog.Content> </AlertDialog.Root>
On This Page