Diamond Diamond

ui · 6 variants · 1 categories

Video Player

Video wrapper — standard, live, vertical portrait, recording, editorial poster, accent.

npx "@rueda.dev/gems-diamond" add video-player
§01

Display

6 variants
0:00
standard
LIVE
2.4k watching
live
portrait
REC0:004K · 60FPS
rec
EP 03 · 12 MIN
The quiet discipline of shipping
editorial
accent

Usage Guide

How to wire up this component in your app — props, callbacks, customization, and the conventions Diamond shares across the library.

Playback API

Mirrors the audio player. Pass src for autonomous mode, or feed playing/progress/currentTime/duration + callbacks for controlled mode.

PropTypeDescription
srcstringVideo URL. Drives a real <video>.
posterstring | ReactNodeFallback shown only when no `src` is provided.
controlsbooleanShow Diamond's built-in chrome (overlay play + bottom bar). Default true.
objectFit"cover" | "contain"Default 'cover'.
playsInlinebooleanInline playback on iOS Safari. Default true.
muted / volume / loop / autoPlay / preloadAll mapped onto the native element.

Variant-specific props

  • liveliveCount shows e.g. "2.4k watching" in the corner.
  • recrecording toggles the REC pulse, tag renders top-right metadata (e.g. "4K · 60FPS").
  • editorial — pair title + subtitle over a gradient mask.
  • portrait — pass sideActions ({ id, icon, onClick?, label? }[]) for vertical react / comment / share buttons.
  • accentspeeds drives the speed switcher; each entry can have a rate (multiplier applied to playbackRate). Use defaultSpeedId or activeSpeedId + onSpeedChange.

Fullscreen

Clicking the corner expander uses document.requestFullscreen on the carousel root — you don't need to wire anything. Works on desktop browsers; iOS Safari falls back to native video chrome.

Universal patterns

Every Diamond component shares the same prop conventions, so once you learn one you can predict the others.

  • variant — discriminated union of every visual option. Categories shown above are docs-only metadata; the prop is a flat string union.
  • accent — any CSS color string. Overrides --diamond-accent just for that instance via inline style. Cascades into hover, ring, and selection states.
  • asChild (when present) — renders the underlying primitive via @radix-ui/react-slot, letting you compose with <Link>, motion.button, etc.
  • className — merged with internal Tailwind classes via cn(). Use it to override layout, spacing, or colors.
  • Native HTML attributes (onClick, aria-*, data-*, ref, etc.) flow through to the root element without any whitelist.
  • Diamond is the skin: zero domain state, zero fetch, zero providers. You wire data and reactions in your app code; the components just render and emit events.