SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

VideoShelf

A titled row of video cards that scrolls sideways, the shelf a catalogue home stacks.

View code
tsx
<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.

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

Usage

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

  • VideoShelf
  • VideoShelf.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.

PropTypeRequiredDescription
idstringYesNames the shelf and its parts; the heading and the scroller derive their ids from it.
titleRemixNodeYesThe shelf's heading, such as "Continue watching".
actionRemixNodeNoA link beside the heading, such as "See all".
labelsLabelsYesThe paging buttons' names, which script reveals.
size"landscape" | "poster"NoDefault: "landscape".
level2 | 3NoThe heading's level. Default: 2.
childrenRemixNodeYesVideoShelf.Item elements, one per card.

Also accepts everything in Omit<TagProps<"section">, "title">.

VideoShelf.Item

Also accepts everything in TagProps<"li">.

Types

NameValuesWhat it decides
Size"landscape" | "poster"Which card shape the shelf holds, which sets how wide each item is.
@sdxc/ui

Can’t find it? Contact us