Menu

Change language

GitHub repo

Sheet

sheetui

Side-mounted modal that slides in from the top, right, bottom, or left edge. Use for filter panels, edit drawers, and mobile menus.

When to use which

Decision Guide

Dialogs capture immediate user focus for critical actions. Sheets slide in from screen edges for deep secondary forms, while Popovers provide lightweight contextual cards.

ComponentRole
Dialog

Critical confirmations, destructive warnings, or focused single-purpose tasks requiring user resolution.

Modal Window
Sheetcurrent

Complex edit forms, filter panes, or shopping carts that retain underlying page context.

Off-Canvas Slide-Over
Drawer

Mobile bottom sheets, touch-friendly sliding panels, or secondary inspection trays.

Edge Panel / Bottom Sheet
Popover

Small contextual dropdowns, color pickers, date pickers, or inline configuration flyouts.

Contextual Floating Card
  • Urgent confirmation or focused prompt → Dialog (view)
  • Side panel for deep form editing → Sheet
  • Mobile bottom sheet or gesture tray → Drawer (view)
  • Anchored contextual flyout or controls → Popover (view)

Installation

$npx shadcn-svelte@latest add https://uipkge.dev/r/svelte/sheet.json
Manifest:https://uipkge.dev/r/svelte/sheet.jsonInstalls to:src/lib/components/ui/sheet/

Examples

Loading interactive previews…

Props

NameType / ValuesDefaultRequired
openboolean—optional
modal

body scroll-lock, and autofocus, and the overlay stops intercepting pointer events so the page stays interactive (Radix `modal` parity).

booleantrueoptional
onOpenChange(open: boolean) => void—optional
childrenSnippet—optional

Schema

Type aliases from this item's source — use them to shape the data you pass in.

SheetContextValue
interface SheetContextValue {
  readonly open: boolean
  setOpen: (open: boolean) => void
  readonly titleId: string | undefined
  setTitleId: (id: string | undefined) => void
  readonly descriptionId: string | undefined
  setDescriptionId: (id: string | undefined) => void
  readonly modal: boolean
}

npm dependencies

Used by

Files installed (11)

  • src/lib/components/ui/sheet/Sheet.svelte1.2 kB
    <script lang="ts" module>
      import type { Snippet } from 'svelte'
    
      export interface SheetProps {
        open?: boolean
        /** When false the sheet is non-modal: content skips the focus trap,
         *  body scroll-lock, and autofocus, and the overlay stops intercepting
         *  pointer events so the page stays interactive (Radix `modal` parity). */
        modal?: boolean
        onOpenChange?: (open: boolean) => void
        children?: Snippet
      }
    </script>
    
    <script lang="ts">
      import { setSheetContext } from './context'
    
      let { open = $bindable(false), modal = true, onOpenChange, children }: SheetProps = $props()
    
      let titleId: string | undefined = $state(undefined)
      let descriptionId: string | undefined = $state(undefined)
    
      function setOpen(next: boolean) {
        if (next === open) return
        open = next
        onOpenChange?.(next)
      }
    
      // Getters over $state keep every consumer reactive without runes in context.ts.
      setSheetContext({
        get open() {
          return open
        },
        setOpen,
        get titleId() {
          return titleId
        },
        setTitleId: (id) => (titleId = id),
        get descriptionId() {
          return descriptionId
        },
        setDescriptionId: (id) => (descriptionId = id),
        get modal() {
          return modal
        },
      })
    </script>
    
    {@render children?.()}
    
  • src/lib/components/ui/sheet/SheetClose.svelte1.1 kB
  • src/lib/components/ui/sheet/SheetContent.svelte4.4 kB
  • src/lib/components/ui/sheet/SheetDescription.svelte0.9 kB
  • src/lib/components/ui/sheet/SheetFooter.svelte0.5 kB
  • src/lib/components/ui/sheet/SheetHeader.svelte0.5 kB
  • src/lib/components/ui/sheet/SheetOverlay.svelte1.1 kB
  • src/lib/components/ui/sheet/SheetTitle.svelte0.8 kB
  • src/lib/components/ui/sheet/SheetTrigger.svelte1.1 kB
  • src/lib/components/ui/sheet/context.ts0.9 kB
  • src/lib/components/ui/sheet/index.ts0.7 kB

Raw manifest:https://uipkge.dev/r/svelte/sheet.json