Rebar UI

1.1

opinion

WaveformAudioPlayer

An audio player with a bar waveform you can click to seek.

Voice noteClick the bars to seek; arrows and Home/End work too

0:00 / 0:00

Few bars, skip 5 seconds

0:00 / 0:00

A different track

0:00 / 0:00

Track appearanceappearance="track": a bare round play glyph, a thin seek rail with a fill and m:ss / m:ss (the plain mobile player)

0:00 / 0:00

On dark art

0:00 / 0:00

Card appearanceappearance="card": a raised card with a round play button, elapsed time, short bar waveform and total time (the app player)

0:00

0:00

In context

MessageA voice note in the crew chat
Voice note
PNPriya NairCrew interviews, 21 Oct 09:40

0:00 / 0:00

Trailing action, playback state, error

Narration barTwo bars share one playing state, so starting one pauses the other

0:00 / 0:00

0:00 / 0:00

0:00 / 0:00

Narration files are not bundled with this site, so playback itself needs real audio; the bar, state and error handling are live.

Buffering

0:00 / 0:00

On dark

0:00 / 0:00

Props

PropTypeRequiredDefault
srcstringYes—
barCountnumber | undefinedNo48
skipSecondsnumber | undefinedNo15
trailingActionReactNodeNo—
autoPlayboolean | undefinedNofalse
onPlayBlocked(() => void) | undefinedNo—
playingboolean | undefinedNo—
onPlayingChange((playing: boolean) => void) | undefinedNo—
onEnded(() => void) | undefinedNo—
onTimeUpdate((currentTime: number, duration: number) => void) | undefinedNo—
errorReactNodeNo—
onRetry(() => void) | undefinedNo—
loadingboolean | undefinedNo—
tone"default" | "onDark" | undefinedNodefault
audioRefRef<HTMLAudioElement> | undefinedNo—
crossOrigin"" | "anonymous" | "use-credentials" | undefinedNo—
controls"text" | "icons" | undefinedNotext
size"default" | "compact" | undefinedNodefault
appearance"track" | "default" | "card" | undefinedNodefault
barHeightsnumber[] | undefinedNo—
playIconReactNodeNo—
pauseIconReactNodeNo—

Waveform

Bar heights are seeded from src, so the same audio always shows the same bars; there is no real amplitude analysis.

data-rebar-* attributes

data-rebar-component="waveform-audio-player"; parts include play-button, skip-back, skip-forward, waveform, bar (with data-played once passed), time.

Migrating to Ant Design

Not codemod-covered. AntD has no audio player; use a dedicated library or a native <audio controls> if you do not need the waveform.

Track appearance

appearance="track" is the plain mobile player: a bare round play/pause glyph, a thin seek rail with a progress fill, and m:ss / m:ss. There are no bars and no skip buttons; the rail is still the role="slider" named Seek. Set --rebar-waveform-track-fill, -rail, -glyph-size, -gap, -height, -rail-height, -time-size, -time-opacity and --rebar-waveform-glyph-ink to match a brand.

Card appearance

appearance="card" draws the app player: a raised rounded card, a round play button (playIcon and pauseIcon swap the glyph), the elapsed time, a short bar waveform (barHeights gives one percent per bar; a bar counts as played while its index over the count is at most the progress) and the total time. Skip buttons are not drawn. Set --rebar-waveform-card-background, -radius, -padding, -shadow, -gap, -play-size, -play-background, -play-color, -time-*, -height, -bar, -bar-played to match a brand.

Icon controls, compact size, audioRef

controls="icons" draws round glyph buttons (play, pause, replay, skip back/forward with the seconds) instead of the labelled text buttons; each keeps its accessible name. size="compact" tightens the bar for lists and cards. audioRef gives you the underlying <audio> element (object or callback ref) and crossOrigin is forwarded to it. The error message uses a danger tone mixed toward the text colour, at least 6:1 on the page and tints in light and dark, and a lighter one on tone="onDark".

<WaveformAudioPlayer src={url} controls="icons" size="compact" audioRef={audio} crossOrigin="anonymous" />

Tokens

Custom properties, set on the component or any ancestor. The default is what applies when one is unset. 30 of 30 were added in 1.1.0 and are marked.

PropertyDefault
--rebar-waveform-card-backgroundvar(--rebar-color-bg-raised, #fff)1.1
--rebar-waveform-card-barrgba(10, 11, 22, 0.15)1.1
--rebar-waveform-card-bar-gap2px1.1
--rebar-waveform-card-bar-playedvar(--rebar-color-primary, #0066cc)1.1
--rebar-waveform-card-bar-radius2px1.1
--rebar-waveform-card-gap10px1.1
--rebar-waveform-card-height32px1.1
--rebar-waveform-card-padding14px 20px 14px 16px1.1
--rebar-waveform-card-play-backgroundvar(--rebar-color-bg-inverse, #12142b)1.1
--rebar-waveform-card-play-colorvar(--rebar-color-text-inverse, #fdfaf5)1.1
--rebar-waveform-card-play-font-size18px1.1
--rebar-waveform-card-play-size44px1.1
--rebar-waveform-card-radius20px1.1
--rebar-waveform-card-shadow0 8px 24px rgba(10, 11, 22, 0.08)1.1
--rebar-waveform-card-time-colorvar(--rebar-color-text-primary, inherit)1.1
--rebar-waveform-card-time-line-heightnormal1.1
--rebar-waveform-card-time-opacity0.551.1
--rebar-waveform-card-time-size12px1.1
--rebar-waveform-track-button-font-size13.3333px1.1
--rebar-waveform-track-button-line-height11.1
--rebar-waveform-track-colorinherit1.1
--rebar-waveform-track-fillvar(--rebar-color-primary, #0066cc)1.1
--rebar-waveform-track-gap12px1.1
--rebar-waveform-track-glyph-size44px1.1
--rebar-waveform-track-height22px1.1
--rebar-waveform-track-railcolor-mix(in srgb, currentColor 25%, transparent)1.1
--rebar-waveform-track-rail-height4px1.1
--rebar-waveform-track-time-line-heightinherit1.1
--rebar-waveform-track-time-opacity0.851.1
--rebar-waveform-track-time-size12px1.1