### Install scrollsheet with bun
Source: https://scrollsheet.dev/docs/getting-started/install
Adds the scrollsheet package using the bun package manager.
```bash
bun add scrollsheet
```
--------------------------------
### Install scrollsheet components via shadcn CLI
Source: https://scrollsheet.dev/docs/getting-started/install
Installs all scrollsheet registry items (drawer, sheet, dialog, confirm, share-sheet, sidebar, toast) using the shadcn CLI. Each writes one file into components/ui/. The confirm and share-sheet items build on drawer, and sidebar builds on sheet; the CLI pulls those dependencies automatically.
```bash
bunx shadcn@latest add https://scrollsheet.dev/r/drawer.json
bunx shadcn@latest add https://scrollsheet.dev/r/sheet.json
bunx shadcn@latest add https://scrollsheet.dev/r/dialog.json
bunx shadcn@latest add https://scrollsheet.dev/r/confirm.json
bunx shadcn@latest add https://scrollsheet.dev/r/share-sheet.json
bunx shadcn@latest add https://scrollsheet.dev/r/sidebar.json
bunx shadcn@latest add https://scrollsheet.dev/r/toast.json
```
--------------------------------
### Centered dialog with Sheet.Root side="center"
Source: https://scrollsheet.dev/docs/presentation/centered-dialog
Basic centered dialog example. The panel is content-sized, centered, and uses zoom+fade. The example's own class sets the width; drag does nothing here.
```jsx
Delete projectDelete this project?This can't be undone.Cancel
```
--------------------------------
### Install scrollsheet with pnpm
Source: https://scrollsheet.dev/docs/getting-started/install
Adds the scrollsheet package using the pnpm package manager.
```bash
pnpm add scrollsheet
```
--------------------------------
### Install scrollsheet with yarn
Source: https://scrollsheet.dev/docs/getting-started/install
Adds the scrollsheet package using the yarn package manager.
```bash
yarn add scrollsheet
```
--------------------------------
### Install scrollsheet with npm
Source: https://scrollsheet.dev/docs/getting-started/install
Adds the scrollsheet package using the npm package manager.
```bash
npm i scrollsheet
```
--------------------------------
### OrderRow component with useTriggerMorph for bottom sheet
Source: https://scrollsheet.dev/docs/presentation/trigger-morph
Defines an OrderRow component that uses useTriggerMorph to morph a button into a bottom sheet. Each row gets a unique name based on order.id to avoid collisions. The sheet uses detents 'content' and 'full', and closes via closeMorph when the open state changes to false.
```tsx
interface Order {
id: string;
title: string;
detail: string;
}
function OrderRow({ order }: { order: Order }) {
const [open, setOpen] = React.useState(false);
// Unique per row: many rows are mounted at once, and each needs its own name.
const name = `order-${order.id}`;
const { triggerRef, openMorph, closeMorph } = useTriggerMorph(name, setOpen);
return (
<>
!next && closeMorph()} detents={['content', 'full']}>
{order.title}
{order.detail}
Done
>
);
}
```
--------------------------------
### Import and use Toaster and toast
Source: https://scrollsheet.dev/docs/toasts
Shows how to import the Toaster component and toast function, mount the Toaster once, and fire toasts with options like description and action. The toast function supports success variants and action buttons.
```jsx
import { Toaster, toast } from 'scrollsheet';
import 'scrollsheet/toast.css';
// mount once, anywhere
;
// fire from any code, component or not
toast('Saved to your list');
toast.success('Synced', { description: 'Two seconds ago.' });
toast('Archived', { action: { label: 'Undo', onClick: restore } });
```
--------------------------------
### Set dialog width with .sheet class
Source: https://scrollsheet.dev/docs/presentation/centered-dialog
Core sets no width on the panel, only guard rails. Size it the same way you'd size any card.
```css
.sheet {
width: 400px;
}
```
--------------------------------
### Check isSupported() to render a custom legacy modal
Source: https://scrollsheet.dev/docs/browser-support
Use this snippet to detect whether the browser supports the