Svelte UI

Dialog Component

Variants

Dialog's variant is 'normal' (default) or 'danger' — it colours the confirm button.

Sizes

Basic Dialog

Delete confirmation — must decide

dismissible={false} makes it "in your face": backdrop-click and Escape are disabled, so the user must pick Cancel or Delete. (Background scroll stays locked either way.)

Custom Content

Confirmation Dialog

Features

Key features

  • Top layer: portaled to <body> — never clipped by an ancestor and never perturbs page layout
  • Composed from Card: border, --ui-border-radius, padding + CardHeader/CardFooter separators come from our own components
  • Dismissible (default true): backdrop-click + Escape close it; dismissible={false} for a must-decide dialog
  • Scroll lock: background scroll is locked while open (scrollbar-width compensated — no sideways jump)
  • Variants: normal + danger (colours the confirm button)
  • Size axis: sm/md/lg (or a responsive map) scales padding + separators
  • Custom content: the children slot renders any markup as the body
  • Customisable buttons: confirmText / cancelText, or hide via showConfirm/showCancel
  • Accessible: role="dialog" + aria-modal, Escape to dismiss