SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

ReelFeed

A full-height vertical feed of short videos, one per screen, the way a reels or shorts tab reads.

mara.quint
Throwing the two halves of a moon jar.

teo.lind
Ninety minutes of harbour fog in twenty seconds.

ines.bakes
Scoring, one cut each, no second chances.

ola.surfs
Seven degrees and you chose this.

View code
tsx
<ReelFeed label="Reels" followAddress prefetchTarget="main">
	{reels.map((reel, index) => (
		<ReelFeed.Item
			href={`/reels/${reel.id}`}
			label={`Reel by ${reel.author}`}
			offset={index - current}
			loopAt={reel.seconds}
			sources={[{ src: reel.webm, type: "video/webm" }]}
			labels={{ pause: "Pause" }}
		>
			<p>{reel.caption}</p>
		</ReelFeed.Item>
	))}
</ReelFeed>

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
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.

Composition

The parts the component publishes, each a static property of the host.

  • ReelFeed
  • ReelFeed.ItemOne 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.

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
labelstringYesThe feed's accessible name, such as "Reels".
followAddressbooleanNoPuts each reel's href in the address bar as it comes on screen, in place, so the address always shares the reel being watched.
autoAdvancebooleanNoMoves 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.
loopbooleanNoRuns 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.
prefetchTargetstringNoThe 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.
childrenRemixNodeYesReelFeed.Item elements in feed order.
controlsRemixNodeNoControls 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

PropTypeRequiredDescription
hrefstringYesThe reel's own address, which the feed follows and prefetches.
labelstringYesThe reel's accessible name, such as "Reel by Mara Quint".
offsetnumberYesThe 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.
sourcesSource[]Yes
loopAtnumberNoPlays the video only this many seconds before looping, for a clip longer than the reel.
backdropRemixNodeNoDrawn behind the video, for a transparent clip or while it loads.
labels{ pause: string }YesThe stage's play button names: it reads pause while playing, pressed once paused.
childrenRemixNodeNoWhat sits over the video: the author, the caption, the action column.

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

@sdxc/ui

Can’t find it? Contact us