CSS
.sheet { background: white; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 40px rgb(0 0 0 / 0.16);}scrollsheet/styles.css includes layout, scroll-snap, backdrop styling, and default panel,
handle, and close-button visuals. Import it once next to your components. Sheet.Content’s
className lands on the panel.
Open it and step through menu, key, and remove. Override the default panel styling with className.
Zero-config entry
Section titled “Zero-config entry”To inject styles at runtime instead of importing CSS, use scrollsheet/auto:
the same components with the stylesheet embedded, injected the first time a sheet opens. Sheets
only render after JS runs, and the stylesheet is injected before the sheet is opened.
import { Sheet } from "scrollsheet/auto";The embed costs 17.9 kB compressed for Sheet against the default
entry’s 14.4. Toasts on the default entry need scrollsheet/toast.css; add scrollsheet/styles.css
when the app also uses sheets or dialogs. Use one entry consistently to avoid duplicate
component code and separate state instances.
Every number above is measured on a production build. Dev-only warning strings sit behind a development/production export condition, the same one Vite, webpack 5+, and Next.js all set automatically. Supported bundlers select a build without those warnings for production. Bundlers that omit the development condition also use the production build during development.
The themeColorDimming controller is a separate chunk, fetched when the prop is enabled.
Dark mode
Section titled “Dark mode”The panel, handle, and close button use light colors by default, regardless of
prefers-color-scheme.
Opt into dark by setting data-scrollsheet-theme="dark" on an ancestor, typically <html>:
<html data-scrollsheet-theme="dark">To make the panel track the OS scheme automatically, use "system" instead:
<html data-scrollsheet-theme="system">Any other value, or no attribute at all, renders light. The attribute is page-level: any
ancestor carrying it switches the built-in defaults, and a nested
data-scrollsheet-theme="light" does not switch a subtree back. To theme one sheet differently
from the rest of the page, set the tokens on that sheet instead.
Your own --scrollsheet-bg, --scrollsheet-fg, --scrollsheet-handle,
--scrollsheet-handle-hover, --scrollsheet-close-bg, --scrollsheet-close-color,
--scrollsheet-close-bg-hover, and --scrollsheet-close-color-hover overrides win in every
mode. The attribute only changes their built-in fallback colors.
Toast styling
Section titled “Toast styling”Toaster renders each card as .scrollsheet-toast (icon: .scrollsheet-toast-icon, body:
.scrollsheet-toast-body, title: .scrollsheet-toast-title, description:
.scrollsheet-toast-description, actions: .scrollsheet-toast-action /
.scrollsheet-toast-cancel / .scrollsheet-toast-close) and reads layout values from
--scrollsheet-toast-* custom properties: --scrollsheet-toast-gap,
--scrollsheet-toast-offset, --scrollsheet-toast-mobile-offset. Override either the same way
you’d style any card:
.scrollsheet-toast { border-radius: 12px;}Sonner compatibility
Section titled “Sonner compatibility”For existing Sonner styles, import { toast, Toaster } from 'scrollsheet' adds sonner-* classes
and data-sonner-* attributes to supported slots. Check your selectors against the rendered
markup. See Migrate from Sonner.
If you do not need Sonner CSS names, use <Toaster sonnerCompat={false}> to render only
.scrollsheet-* classes and attributes.