Component
AlertDialog
A decision that has to be answered before anything else continues.
import { AlertDialog } from '@loidolt/theme-svelte';
Example
Last answer: nothing yet
Notes
- No close affordance and no outside-click dismissal: a confirmation you can dismiss by missing is not one.
- Focus opens on Cancel, so a stray Enter cannot confirm a destructive action.
- Confirming closes the dialog. Work that has to keep it open can set the bindable
openback totrue. triggerVariant/triggerSizepick the trigger button clothes; an explicittriggerClasswins wholesale.
Props
Generated from the component source, so it cannot drift from the implementation.
| Prop | Type | Default | Notes |
|---|---|---|---|
title required | string | — | |
cancelLabel | string | 'Cancel' | |
children | Snippet | — | Extra body content between the description and the buttons. |
class | string | — | class lands on the portaled Content element. |
confirmLabel | string | 'Confirm' | |
confirmVariant | ActionVariant | 'primary' | Colour of the confirm button. Use danger for anything destructive. |
description | string | — | What confirming will do. Say the consequence here, not in the button. |
headingLevel | HeadingLevel | 2 | |
onCancel | () => void | — | |
onConfirm | () => void | — | |
onOpenChange | (open: boolean) => void | — | |
open bindable | boolean | false | |
overlayClass | string | — | |
ref bindable | HTMLElement | null | null | |
size | DialogSize | 'sm' | |
trigger | Snippet | — | Trigger contents, rendered inside a button styled with triggerClass. |
triggerChild | Snippet<[TriggerChildProps]> | — | Full control of the trigger element — receives the props Bits needs on it. |
triggerClass | string | — | |
triggerSize | ControlSize | — | |
triggerVariant | ActionVariant | — | Button variant for the default trigger. An explicit triggerClass wins wholesale. |
Plus the attributes of Omit<AlertDialogContentProps, 'children' | 'class' | 'child'>, forwarded to the root element.