# ReelFeed

> A full-height vertical feed of short videos, one per screen, the way a reels or shorts tab reads: native scroll snap moves it under the thumb, and its island loads only the reels around the one on screen, plays that one, and steps one reel per key or wheel flick.

```ts
import { ReelFeed } from "@sdxc/ui/video";
```

Renders the feed: a labelled `feed` scroller that snaps one reel per screen, and the island
that runs it. It keeps scrolling and snapping without script; the reel at `offset` 0 is
where the scroller starts and the one that autoplays.

## Examples

```tsx
<ReelFeed label="Reels" followAddress prefetchTarget="main">
	{reels.map((reel, index) => <ReelFeed.Item href={reel.href} label={reel.label}
		offset={index - current} sources={reel.sources} labels={{ pause: "Pause" }} />)}
</ReelFeed>
```

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `label` | `string` | The feed's accessible name, such as "Reels". |
| `followAddress?` | `boolean` | Puts each reel's `href` in the address bar as it comes on screen, in place, so the address always shares the reel being watched. |
| `autoAdvance?` | `boolean` | Moves on to the next reel when the one on screen reaches its end, the way a reels tab plays through; the last reel loops. Without it every reel loops until the visitor swipes. |
| `loop?` | `boolean` | Runs on from the last reel to the first, by swipe, key, wheel, step control or `autoAdvance`, so the feed never ends; the island adds a copy of the first reel to do it. |
| `prefetchTarget?` | `string` | The frame the next reel's page is prefetched into, such as `main`, so moving to it with a link renders without waiting; the document hint is prefetched either way. |
| `children` | `RemixNode` | ReelFeed.Item elements in feed order. |
| `controls?` | `RemixNode` | Controls beside the scroller, such as up and down arrows: an element marked `data-reel-step="1"` or `"-1"` steps the feed, so a link to the next reel moves it in place; the island keeps its link on the neighbouring reel and marks it `aria-disabled` at an end. |

Also accepts everything in `TagProps<"section">`.


### ReelFeed.Item

One reel: a screen-high snap point holding a stage as tall as the feed and at most 9:16 wide, with the backdrop, the video, a full-stage play button and the overlay over it, and a progress line along its foot.

| Prop | Type | Description |
| --- | --- | --- |
| `href` | `string` | The reel's own address, which the feed follows and prefetches. |
| `label` | `string` | The reel's accessible name, such as "Reel by Mara Quint". |
| `offset` | `number` | The reel's index minus the index of the reel the page opens on: `0` marks that reel, which the scroller starts at and which autoplays, and the distance sets its `preload`. |
| `sources` | `Source[]` |  |
| `loopAt?` | `number` | Plays the video only this many seconds before looping, for a clip longer than the reel. |
| `backdrop?` | `RemixNode` | Drawn behind the video, for a transparent clip or while it loads. |
| `labels` | `{ pause: string }` | The stage's play button names: it reads `pause` while playing, pressed once paused. |
| `children?` | `RemixNode` | What sits over the video: the author, the caption, the action column. |

Also accepts everything in `Omit<TagProps<"article">, "children">`.

