# Story Sequence

> Chapters that swap a pinned image as you scroll.

```tsx
import { StorySequence } from '@brand-studio/ui';
import { chapters } from '@/demos/assets';

export default function StorySequenceDemo() {
  return <StorySequence title="A morning ritual in three frames." chapters={chapters} />;
}
```

## 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, StorySequence } from '@brand-studio/ui';
import brand from './brand.json';

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

## Usage

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

```tsx
<StorySequence title="A morning ritual." chapters={chapters} />
```

## Accessibility

- On wide screens with motion allowed, one pinned image changes as each chapter scrolls past.
- On phones, without JavaScript and under reduced motion, every image stays in the flow beside its chapter.

## API Reference

| Prop | Type | Default |
|---|---|---|
| `title` | `string` | – |
| `chapters` | `StoryChapter[]` | – |
| `id?` | `string` | – |
| `motion?` | `"auto" \| "off"` | `'auto'` |

Source: https://brandstudio.js.org/docs/components/story-sequence/
