Dialog
A modal, interactive content box that can be submitted or dismissed.
Code
<script lang="ts">
import { Dialog } from '@geoffcox/sterling-svelte';
</script>
<Dialog bind:open bind:returnValue>
<!-- Add content snippet or header, body, and footer snippets -->
</Dialog>
Members
| Property Name | Type | Default | Comment |
---|
| backdropCloses | boolean | null | undefined | false |
| body | Snippet | undefined | undefined |
| content | Snippet | undefined | undefined |
| footer | Snippet | undefined | undefined |
| header | Snippet| undefined | undefined |
| headerTitle | string | Snippet | undefined | undefined |
| open | boolean | null | undefined | false |
| returnValue | string | undefined | '' |
| variant | string | '' |
Considerations
- The dialog is always modal.
- The cancel event is only raised when the escape key is pressed.
- Includes HTMLDialogElement props, events, and methods.
Anatomy
<dialog class="sterling-dialog">
<form>
<div class="content">
{#if content}
{@render content()}
{:else}
<div class="header">
{@render header()}
<div class="title">
{@render headerTitle()}
</div>
<div class="close">
<Button>
<div class="close-x">
</div>
</Button>
</div>
</div>
<div class="body">
{@render body()}
</div>
<div class="separator"></div>
<div class="footer">
{@render footer()}
</div>
{/if}
</div>
</form>
</dialog>