- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
- Typography
Installation#
pnpm dlx shadcn@latest add @force-ui-svelte/alert-dialog
Usage#
<script lang="ts">
import * as AlertDialog from "$lib/components/ui/alert-dialog/index.js";
</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>Composition#
Use the following composition to build an AlertDialog:
AlertDialog.Root
├── AlertDialog.Trigger
└── AlertDialog.Content
├── AlertDialog.Header
│ ├── AlertDialog.Media
│ ├── AlertDialog.Title
│ └── AlertDialog.Description
└── AlertDialog.Footer
├── AlertDialog.Cancel
└── AlertDialog.ActionExamples#
Basic#
A basic alert dialog with a title, description, and cancel and continue buttons.
Small#
Use the size="sm" prop to make the alert dialog smaller.
Media#
Use the AlertDialog.Media component to add a media element such as an icon or image to the alert dialog.
Small with Media#
Use the size="sm" prop to make the alert dialog smaller and the AlertDialog.Media component to add a media element such as an icon or image to the alert dialog.
Destructive#
Use the AlertDialog.Action component to add a destructive action button to the alert dialog.
RTL#
To enable RTL support in Force UI, see the RTL configuration guide.
API Reference#
size#
Use the size prop on the AlertDialog.Content component to control the size of the alert dialog. It accepts the following values:
| Prop | Type | Default |
|---|---|---|
size | "default" | "sm" | "default" |
For more information about the other components and their props, see the Radix UI documentation.