Skip to content
LoidoltTheme 0.11.1
Svelte 5

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 open back to true.
  • triggerVariant/triggerSize pick the trigger button clothes; an explicit triggerClass wins wholesale.

Props

Generated from the component source, so it cannot drift from the implementation.

AlertDialog props
PropTypeDefaultNotes
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 HeadingLevel2
onCancel () => void—
onConfirm () => void—
onOpenChange (open: boolean) => void—
open bindablebooleanfalse
overlayClass string—
ref bindableHTMLElement | nullnull
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.