Layer Dialog
kumo-svelte
<script lang="ts">
  import { Button } from 'kumo-svelte/components/button';
  import { LayerDialog } from 'kumo-svelte/components/layer-dialog';
</script>

<LayerDialog>
  <LayerDialog.Trigger>
    {#snippet child({ props })}<Button {...props}>Open layer dialog</Button>{/snippet}
  </LayerDialog.Trigger>
  <LayerDialog.Content>
    <LayerDialog.Title>Edit profile</LayerDialog.Title>
    <LayerDialog.Description>Update the details associated with this profile.</LayerDialog.Description>
    <LayerDialog.Body>
      <div class="min-h-40">Profile form content</div>
    </LayerDialog.Body>
    <LayerDialog.Actions dismissLabel="Close">
      <LayerDialog.Actions.Primary>Save changes</LayerDialog.Actions.Primary>
    </LayerDialog.Actions>
  </LayerDialog.Content>
</LayerDialog>

Installation

import {LayerDialog} from 'kumo-svelte';

Behavior

LayerDialog renders as a bottom sheet on small screens and a centered dialog on desktop. Set dismissDisabled while asynchronous work is pending. Use LayerDialog.Alert when the user must explicitly choose an action.

Alert dialog

<script lang="ts">
  import { Button } from 'kumo-svelte/components/button';
  import { LayerDialog } from 'kumo-svelte/components/layer-dialog';
</script>

<LayerDialog.Alert>
  <LayerDialog.Trigger>
    {#snippet child({ props })}<Button variant="destructive" {...props}>Delete project</Button>{/snippet}
  </LayerDialog.Trigger>
  <LayerDialog.Content>
    <LayerDialog.Title>Delete project?</LayerDialog.Title>
    <LayerDialog.Description>This action cannot be undone.</LayerDialog.Description>
    <LayerDialog.Body>All deployments and settings will be permanently removed.</LayerDialog.Body>
    <LayerDialog.Actions dismissLabel="Cancel">
      <LayerDialog.Actions.Primary variant="destructive">Delete</LayerDialog.Actions.Primary>
    </LayerDialog.Actions>
  </LayerDialog.Content>
</LayerDialog.Alert>

API Reference

PropTypeDefaultDescription
open boolean-Controlled open state.
onOpenChange (open: boolean) => void-Called when the open state changes.
dismissDisabled booleanfalsePrevents user-initiated dismissal while work is pending.
PropTypeDefaultDescription
size 'sm' | 'base' | 'lg' | 'xl'"base"Desktop dialog width.
verticalAlign 'top' | 'center'"center"Desktop vertical alignment.
container HTMLElement | string-Portal destination.
closeLabel string"Close"Accessible label for the automatic close control.

Use LayerDialog.Action inside LayerDialog.Actions. Pass a menu snippet containing DropdownMenu.Item children for related outcomes and menuLabel for the split trigger name. Native button props such as form, type="submit", and disabled pass through. Actions.Primary remains a deprecated alias. Svelte snippets cannot be inspected as React child arrays; keep exactly one direct action in the footer.

<script lang="ts">
  import { LayerDialog, DropdownMenu, Button, Input } from "#lib/index.js";
</script>

<LayerDialog.Root
  ><LayerDialog.Trigger
    >{#snippet child({ props })}<Button {...props}>Edit deployment</Button
      >{/snippet}</LayerDialog.Trigger
  ><LayerDialog.Content
    ><LayerDialog.Title>Save deployment</LayerDialog.Title
    ><LayerDialog.Description
      >Deploy these changes now, or keep them as a draft.</LayerDialog.Description
    ><LayerDialog.Body
      ><form id="deployment-form" onsubmit={(event) => event.preventDefault()}>
        <Input label="Service name" name="serviceName" required />
      </form></LayerDialog.Body
    ><LayerDialog.Actions dismissLabel="Cancel"
      ><LayerDialog.Action
        form="deployment-form"
        type="submit"
        menuLabel="Save options"
        >Save and deploy{#snippet menu()}<DropdownMenu.Item
            >Save as draft</DropdownMenu.Item
          >{/snippet}</LayerDialog.Action
      ></LayerDialog.Actions
    ></LayerDialog.Content
  ></LayerDialog.Root
>

Use <LayerDialog.Separator /> inside LayerDialog.Body to divide sections with a full-width hairline. LayerDialogSeparator is also available as a named export.