VideoShelf
A titled row of video cards that scrolls sideways, the shelf a catalogue home stacks.
View code
<VideoShelf
id="continue"
title="Continue watching"
action={<a href="/my-list">See all</a>}
labels={{ previous: "Previous titles", next: "More titles" }}
>
{titles.map((title) => (
<VideoShelf.Item>
<VideoCard
href={title.href}
title={title.name}
art={<img src={title.still} alt="" />}
meta={title.episode}
progress={title.watched}
progressLabel={`${Math.round(title.watched * 100)}% watched`}
/>
</VideoShelf.Item>
))}
</VideoShelf>Installation
An ordinary dependency: install it, import the theme once, and import the component where it is used.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
import { VideoShelf } from "@sdxc/ui/video";Renders the shelf: the heading row, then the scroller holding a list of items, between two paging buttons kept hidden until the shelf's island reveals them. The scroller is a labelled region, so a keyboard reaches it and scrolls it with the arrow keys.
Composition
The parts the component publishes, each a static property of the host.
VideoShelfVideoShelf.ItemOne card's place in the shelf, snapping to the scroller's start so a step lands on a card's edge rather than through one.
Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Names the shelf and its parts; the heading and the scroller derive their ids from it. |
title | RemixNode | Yes | The shelf's heading, such as "Continue watching". |
action | RemixNode | No | A link beside the heading, such as "See all". |
labels | Labels | Yes | The paging buttons' names, which script reveals. |
size | "landscape" | "poster" | No | Default: "landscape". |
level | 2 | 3 | No | The heading's level. Default: 2. |
children | RemixNode | Yes | VideoShelf.Item elements, one per card. |
Also accepts everything in Omit<TagProps<"section">, "title">.
VideoShelf.Item
Also accepts everything in TagProps<"li">.
Types
| Name | Values | What it decides |
|---|---|---|
Size | "landscape" | "poster" | Which card shape the shelf holds, which sets how wide each item is. |