Sheet
Extends the Dialog component to display content that complements the main content of the screen.
Installation
pnpm add @heyramzi/ui bits-uiUsage
import * as Sheet from "@heyramzi/ui/shadcn/sheet";<Sheet.Root>
<Sheet.Trigger>Edit client</Sheet.Trigger>
<Sheet.Content side="right">
<Sheet.Header>
<Sheet.Title>Edit client</Sheet.Title>
<Sheet.Description>Shown on invoices and the portal.</Sheet.Description>
</Sheet.Header>
<Sheet.Body>
<input aria-label="Name" value="Acme Corp" />
</Sheet.Body>
<Sheet.Footer band>
<Sheet.Close>Cancel</Sheet.Close>
</Sheet.Footer>
</Sheet.Content>
</Sheet.Root>Keyboard and accessibility
| Key | Does |
|---|---|
| Tab | Moves focus to the next control inside the sheet. |
| Shift Tab | Moves focus to the previous control inside the sheet. |
| Esc | Closes the sheet and returns focus to the trigger. |
- A sheet is a dialog from the edge, so Tab can't leave it while it's open.
- The close button is named "Close", or whatever `closeLabel` says.
- Sheet.Title and Sheet.Description name and describe it for a screen reader.
API reference
Sheet.Root
openbindableboolean- Default
false ...rest- Every prop of
Dialog.Rootfrombits-ui
| Prop | Type | Default |
|---|---|---|
open bindable | boolean | false |
...rest | Every prop of Dialog.Root from bits-ui | |
Sheet.Trigger
refbindableHTMLElement | null- Default
null ...rest- Every prop of
Dialog.Triggerfrombits-ui
| Prop | Type | Default |
|---|---|---|
ref bindable | HTMLElement | null | null |
...rest | Every prop of Dialog.Trigger from bits-ui | |
Sheet.Content
portalPropsWithoutChildrenOrChild<ComponentProps<typeof SheetPortal>>side"left" | "right" | "bottom"- Default
"right" showCloseButtonboolean- Default
true closeLabelstring- Default
"Close" - What a screen reader calls the built-in close button, in the app's language.
floatingboolean- From `sm` up a left or right sheet floats 8px off the edge, like SidePanel; `floating={false}` keeps it flush. A phone stays full bleed for the width.
childrenrequiredSnippetrefbindableHTMLElement | null- Default
null classstring...rest- Every prop of
Dialog.Contentfrombits-uiexceptchild, children
| Prop | Type | Default |
|---|---|---|
portalProps | WithoutChildrenOrChild<ComponentProps<typeof SheetPortal>> | |
side | "left" | "right" | "bottom" | "right" |
showCloseButton | boolean | true |
closeLabel What a screen reader calls the built-in close button, in the app's language. | string | "Close" |
floating From `sm` up a left or right sheet floats 8px off the edge, like SidePanel; `floating={false}` keeps it flush. A phone stays full bleed for the width. | boolean | |
children required | Snippet | |
ref bindable | HTMLElement | null | null |
class | string | |
...rest | Every prop of Dialog.Content from bits-ui except child, children | |
Sheet.Header
refbindableHTMLDivElement | null- Default
null classstringchildrenSnippet...rest- Every prop of
HTMLAttributes<HTMLDivElement>fromsvelte/elements
| Prop | Type | Default |
|---|---|---|
ref bindable | HTMLDivElement | null | null |
class | string | |
children | Snippet | |
...rest | Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements | |
Sheet.Title
refbindableHTMLElement | null- Default
null classstring...rest- Every prop of
Dialog.Titlefrombits-ui
| Prop | Type | Default |
|---|---|---|
ref bindable | HTMLElement | null | null |
class | string | |
...rest | Every prop of Dialog.Title from bits-ui | |
Sheet.Description
refbindableHTMLElement | null- Default
null classstring...rest- Every prop of
Dialog.Descriptionfrombits-ui
| Prop | Type | Default |
|---|---|---|
ref bindable | HTMLElement | null | null |
class | string | |
...rest | Every prop of Dialog.Description from bits-ui | |
Sheet.Footer
bandboolean- Default
false - A hairline on top and a quiet surface edge to edge, following the sheet's bottom corners when it floats. A bare `data-band` attribute does the same.
refbindableHTMLDivElement | null- Default
null classstringchildrenSnippet...rest- Every prop of
HTMLAttributes<HTMLDivElement>fromsvelte/elements
| Prop | Type | Default |
|---|---|---|
band A hairline on top and a quiet surface edge to edge, following the sheet's bottom corners when it floats. A bare `data-band` attribute does the same. | boolean | false |
ref bindable | HTMLDivElement | null | null |
class | string | |
children | Snippet | |
...rest | Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements | |
Sheet.Close
refbindableHTMLElement | null- Default
null ...rest- Every prop of
Dialog.Closefrombits-ui
| Prop | Type | Default |
|---|---|---|
ref bindable | HTMLElement | null | null |
...rest | Every prop of Dialog.Close from bits-ui | |
Sheet.Portal
...rest- Every prop of
Dialog.Portalfrombits-ui
| Prop | Type | Default |
|---|---|---|
...rest | Every prop of Dialog.Portal from bits-ui | |
Sheet.Overlay
refbindableHTMLElement | null- Default
null classstring...rest- Every prop of
Dialog.Overlayfrombits-ui
| Prop | Type | Default |
|---|---|---|
ref bindable | HTMLElement | null | null |
class | string | |
...rest | Every prop of Dialog.Overlay from bits-ui | |
Sheet.Body
refbindableHTMLDivElement | null- Default
null classstringchildrenSnippet...rest- Every prop of
HTMLAttributes<HTMLDivElement>fromsvelte/elements
| Prop | Type | Default |
|---|---|---|
ref bindable | HTMLDivElement | null | null |
class | string | |
children | Snippet | |
...rest | Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements | |