Sheet Modal is a special overlay type. Such modal allows to create custom picker overlays with custom content.
There are following components included:
Sheet
- sheet modal elementName | Type | Default | Description |
---|---|---|---|
backdrop | boolean | true | Enables Sheet modal backdrop (dark semi transparent layer behind) |
colors | object | Object with Tailwind CSS colors classes | |
colors.bgIos | string | 'bg-ios-light-surface-1 dark:bg-ios-dark-surface-1' | |
colors.bgMaterial | string | 'bg-md-light-surface dark:bg-md-dark-surface' | |
onBackdropClick | function(e) | Click handler on backdrop element | |
opened | boolean | false | Allows to open/close Sheet modal and set its initial state |
<script>import CloseIcon from '../components/CloseIcon.svelte';import {Page,Navbar,NavbarBackLink,Sheet,Block,Button,Toolbar,ToolbarPane,Link,} from 'konsta/svelte';let sheetOpened = $state(false);</script><Page><Navbar title="Sheet Modal">{#snippet left()}{#if !isPreview}<NavbarBackLink onclick={() => history.back()} />{/if}{/snippet}</Navbar><Block strong inset class="space-y-4"><p>Sheet Modals slide up from the bottom of the screen to reveal morecontent. Such modals allow to create custom overlays with custom content.</p><p><Button rounded onclick={() => (sheetOpened = true)}>Open Sheet</Button></p></Block><Sheetclass="pb-safe"opened={sheetOpened}onBackdropClick={() => (sheetOpened = false)}><Toolbar top class="justify-end ios:pt-4"><div class="ios:hidden"></div><ToolbarPane><Link iconOnly onClick={() => (sheetOpened = false)}><CloseIcon /></Link></ToolbarPane></Toolbar><Block><p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Harum adexcepturi nesciunt nobis aliquam. Quibusdam ducimus nequenecessitatibus, molestias cupiditate velit nihil alias incidunt,excepturi voluptatem dolore itaque sapiente dolores!</p><div class="mt-4"><Button large rounded onclick={() => (sheetOpened = false)}>Action</Button></div></Block></Sheet></Page>