Overlays Core Stable

Dialog

A modal panel with a title, description, body and free-form footer — portals out, traps focus, and locks the page's scroll while open

Preview

Installation

pnpm add fancy-ui-svelte
import { Dialog } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { Dialog } from 'fancy-ui-svelte';
</script>

<Dialog />

Examples

Basic Usage

A trigger, title, description, body and footer.

Controlled Open

Non-bound open plus onOpenChange, no trigger snippet.

Not Dismissible

dismissible={false} — Escape and outside click both disabled.

Custom Initial Focus

Sends focus to a specific field instead of the default close button.

Props

PropTypeDefaultDescription
open booleanfalseWhether the dialog is open; bindable
onOpenChange (open: boolean) => void-Fires whenever open changes, from any trigger
title string-The heading. Omitted entirely (not just visually) when not given
description string-The copy under the title. Same omission rule as title
dismissible booleantrueWhether Escape and an outside click close the dialog; the close button always works
initialFocus HTMLElement | null-Element to focus once the dialog opens; defaults to the first focusable descendant
class string-Additional CSS classes for the panel
ref HTMLDivElement | nullnullBindable reference to the panel element

Slots

SlotDescription
childrenThe dialog's body
footerThe action row under the body — free-form, callers build their own buttons
triggerOptional trigger; renders in place and opens the dialog on activation