Knit UI
GitHub

Playground

Loading playground…

Playground
<AudioPlaylist
  sources={[{ uri: "https://samplelib.com/mp3/sample-30s.mp3", name: "Sample 30s" }, { uri: "https://samplelib.com/mp3/sample-15s.mp3", name: "Sample 15s" }, { uri: "https://samplelib.com/mp3/sample-12s.mp3", name: "Sample 12s" }]}
  size="md"
  controls
  showTrackList
  loop="none"
/>

Examples

Basic

Loading example…

BasicSourceStorybook

Loop All

Loading example…

Loop AllSourceStorybook

Long Tracks

A queue of full-length tracks — real durations to scrub and queue through.

Loading example…

Long TracksSourceStorybook

No Track List

Loading example…

No Track ListSourceStorybook

Styles

Loading example…

StylesSourceStorybook

Props

PropTypeDefaultDescription
controlsReactNodetrueControl chrome: `true` (default bar + track list), `false`, or custom node.
getController((controller: AudioPlaylistController) => void) | undefined
keyboardboolean | undefinedEnable keyboard shortcuts. Default `true`.
labelstring | undefinedAccessible label. Default `"Audio playlist"`.
loopAudioPlaylistLoopMode | undefined
none · single · all
noneInitial loop mode. Default `'none'`.
maxWidthnumber | Animated.AnimatedNode | GetThemeValueForKey<"maxWidth"> | null | undefined
mutedboolean | undefinedStart muted.
onEnded(() => void) | undefined
onError((error: AudioError) => void) | undefined
onTrackChange((currentIndex: number, previousIndex: number) => void) | undefined
playbackRatenumber | undefinedInitial playback rate.
showTrackListboolean | undefinedtrueShow the track list. Default `true`.
size system"xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl" | undefined
xs · sm · md · lg · xl
mdControl sizing scale. Default `'md'`.
sourcesAudioSource[] | undefinedInitial playlist sources.
styles systemSlotStyles<AudioPlaylistStyles> | undefined
testIDstring | undefined
volumenumber | undefinedInitial volume, 0..1.
widthnumber | GetThemeValueForKey<"width"> | Animated.AnimatedNode | null | undefined

Style slots

Every part of AudioPlaylist can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotUsage
rootstyles={{ root: { … } }}
timestyles={{ time: { … } }}
trackLabelstyles={{ trackLabel: { … } }}
trackListstyles={{ trackList: { … } }}
trackRowstyles={{ trackRow: { … } }}