Track List
ProNewThe tracks of a release. Each row's number is its play button, turning into moving bars while that track plays, with a line of progress under the current one.
Installation
pnpm dlx shadcn@latest add @viewport/track-list
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| tracks* | Track[] | — |
| current | string | nullThe track that is loaded, and whether it is playing. | — |
| playing | boolean | false |
| progress | numberHow far through the current track playback is, from 0 to 1. | 0 |
| onPlayChange | (id: string, playing: boolean) => voidCalled with the track and whether it should play. | — |
| label | stringAccessible name, e.g. the release's title. | "Tracks" |
| className | string | — |
Accessibility
- An ordered list; each play button is named with its track and reports whether it is playing.
- The play icon appears on focus as well as on hover.
- Explicit is a letter with hidden text, not color alone.
- The bars stand still under reduced motion.