Sheet
A flyout that opens from the side of the screen, based on the dialog component.
<script lang="ts">
import {
Button,
Field,
FieldLabel,
Form,
Input,
Sheet,
SheetClose,
SheetDescription,
SheetFooter,
SheetHeader,
SheetPanel,
SheetPopup,
SheetTitle,
SheetTrigger,
} from "coss-svelte";
</script>
<Sheet>
<SheetTrigger>Open Sheet</SheetTrigger>
<SheetPopup>
<SheetHeader>
<SheetTitle>Edit profile</SheetTitle>
<SheetDescription>
Make changes to your profile here. Click save when you’re done.
</SheetDescription>
</SheetHeader>
<Form class="contents">
<SheetPanel class="grid gap-4">
<Field>
<FieldLabel>Name</FieldLabel>
<Input value="Margaret Welsh" type="text" />
</Field>
<Field>
<FieldLabel>Username</FieldLabel>
<Input value="@maggie.welsh" type="text" />
</Field>
</SheetPanel>
<SheetFooter>
<SheetClose>Cancel</SheetClose>
<Button type="submit">Save</Button>
</SheetFooter>
</Form>
</SheetPopup>
</Sheet>
Installation
Install the component package, shared coss-svelte theme, and Bits UI peer.
npm install coss-svelte @coss-svelte/theme bits-uiUsage
Import the Svelte component exports directly from the package.
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetPanel, SheetPopup, SheetTitle, SheetTrigger } from "coss-svelte";Anatomy
- Sheet
- SheetClose
- SheetContent
- SheetDescription
- SheetFooter
- SheetHeader
- SheetPanel
- SheetPopup
- SheetTitle
- SheetTrigger
API Reference
Sheet
A flyout that opens from the side of the screen, based on the dialog component.
| Prop | Type | Default | Description |
|---|---|---|---|
bind:open | boolean | false | Open state for the popup or disclosure. Bind with `bind:open`. |
side | "top" | "right" | "bottom" | "left" | "right" | Side from which the surface appears. |
trigger | string | "Open" | Fallback trigger text rendered when custom children are not provided. |
title | string | "" | Title text rendered by the component's built-in fallback layout. |
description | string | "" | Supporting text rendered by the component's built-in fallback layout. |
children : Snippet<[]>Inherits from Bits UI Dialog.Root.
SheetClose
Renders a control that closes the parent surface.
children : Snippet<[]>child : Snippet<[{ props: Record<string, unknown> }]>bind:ref : HTMLElement | nullInherits from Bits UI Dialog.Close.
SheetContent
Wraps the primary content for the parent component.
children : Snippet<[]>Inherits from Svelte component attributes.
SheetDescription
Provides supporting copy for the parent component.
children : Snippet<[]>bind:ref : HTMLElement | nullInherits from Bits UI Dialog.Description.
SheetHeader
Groups heading content for the parent component.
children : Snippet<[]>Inherits from Svelte component attributes.
SheetPanel
Renders the main panel surface for the parent component.
children : Snippet<[]>Inherits from Svelte component attributes.
SheetPopup
Renders the floating or modal surface for the parent component.
| Prop | Type | Default | Description |
|---|---|---|---|
side | "top" | "right" | "bottom" | "left" | "right" | Side from which the surface appears. |
portalProps | { disabled?: boolean; to?: PortalTarget } | {} | Configures the exact Bits Portal target (`to`) or renders inline when `disabled`. |
children : Snippet<[]>bind:ref : HTMLElement | nullInherits from Bits UI Dialog.Content.
SheetTitle
Names the parent surface or section.
children : Snippet<[]>bind:ref : HTMLElement | nullInherits from Bits UI Dialog.Title.
SheetTrigger
Renders the control that opens, closes, or selects related content.
children : Snippet<[]>child : Snippet<[{ props: Record<string, unknown> }]>bind:ref : HTMLElement | nullInherits from Bits UI Dialog.Trigger.
Implementation Details
- Status
- Stable
- Foundation
- compound
- Category
- Overlays & Popups
- Particles
- 3