# Scroll Stack

> Cards that pin and pile up as you scroll.

```tsx
import { ScrollStack } from '@brand-studio/ui';
import { beans, cup, pour } from '@/demos/assets';

export default function ScrollStackDemo() {
  return (
    <div style={{ width: '100%' }}>
      <ScrollStack
        cards={[
          { id: 'source', title: 'We buy from twelve farms', body: 'Direct relationships, visited every harvest.', asset: beans },
          { id: 'roast', title: 'We roast on Tuesdays', body: 'Small batches, shipped within two days.', asset: pour },
          { id: 'brew', title: 'You brew it your way', body: 'Guides for every method, from moka pot to cold brew.', asset: cup },
        ]}
      />
    </div>
  );
}
```

## Installation

```sh
npm install @brand-studio/ui
```

React 18 or 19 is a peer dependency. Import the stylesheet once and wrap the app in a brand theme:

```tsx
import '@brand-studio/ui/styles.css';
import { BrandTheme, ScrollStack } from '@brand-studio/ui';
import brand from './brand.json';

<BrandTheme palette={brand.tokens} mode="system">
  {/* your app */}
</BrandTheme>
```

## Usage

```tsx
import { ScrollStack } from '@brand-studio/ui';
```

```tsx
<ScrollStack cards={cards} />
```

## Accessibility

- Cards are an ordered list with sticky positioning, so they read in order without JavaScript.
- Under reduced motion the covered cards do not shrink.

## API Reference

| Prop | Type | Default |
|---|---|---|
| `cards` | `StackCard[]` | – |
| `className?` | `string` | `''` |

Source: https://brandstudio.js.org/docs/components/scroll-stack/
