Skip to content

Video

Plays a video at a set ratio and fit, with a poster image and a placeholder when the source is missing. By default it plays muted on a loop, unless the user prefers reduced motion, with a pause button.

// Plain markup
import { Video } from "@shavin/ui";

Placeholder (no source)

Component Source
{/* No src → a graceful SVG placeholder, sized by ratio */}
<Video ratio="16/9" className="w-64" />

With a source and poster

Component Source
<Video
  src="/hero.mp4"
  poster="/hero-poster.jpg"
  ratio="16/9"
  className="w-64"
/>

Aspect ratios

Component Source
<Video src="/clip.mp4" ratio="1/1" className="w-32" />
<Video src="/clip.mp4" ratio="4/3" className="w-32" />
<Video src="/clip.mp4" ratio="16/9" className="w-32" />

Fit

Component Source
{/* object-fit: cover (default) vs contain */}
<Video src="/tall.mp4" fit="cover" ratio="1/1" className="w-32" />
<Video src="/tall.mp4" fit="contain" ratio="1/1" className="w-32" />

Radius

Component Source
<Video radius="none" ratio="1/1" className="w-24" />
<Video radius="medium" ratio="1/1" className="w-24" />
<Video radius="large" ratio="1/1" className="w-24" />
<Video radius="full" ratio="1/1" className="w-24" />

Concentric radius

Component Source
{/* radius="concentric" auto-resolves the inner
   radius from the container's padding */}
<Card padding="md">
  <Video src="/hero.mp4" poster="/hero.jpg" ratio="16/9" radius="concentric" />
</Card>

With controls (user-playable)

Component Source
{/* controls + no autoplay → user-initiated playback */}
<Video
  src="/demo.mp4"
  poster="/demo.jpg"
  ratio="16/9"
  controls
  autoPlay={false}
  className="w-64"
/>

Props

PropTypeDefaultDescription
srcstring—Video source URL.
posterstring—Poster image URL shown before the video loads/plays.
fit"cover" | "contain" | "fill" | "none"coverObject fit style: "cover", "contain", "fill", "none". Default "cover".
ratiostring—CSS aspect-ratio string, e.g. "16/9", "1/1". Reserves space to avoid layout shift.
autoPlaybooleantrueAutoplay the video (muted is required by browsers for autoplay). Default true.
loopbooleantrueLoop the video. Default true.
mutedbooleantrueMute the video. Default true.
controlsbooleanfalseShow native browser controls. Default false.
placeholderReact.ReactNode—Custom placeholder node shown when src is missing.
captionsstring—WebVTT captions file for speech or meaningful sound (WCAG 1.2.2).
captionsLangstringenLanguage of the captions track. Default "en".
labelstring—What the video shows, for screen readers. Omit with `decorative`.
decorativeboolean—Pure ambience (a background loop): hidden from screen readers. The pause button stays.
radius"none" | "small" | "medium" | "large" | "full" | "inherit" | "concentric""inherit"—
Configure Theme
Theme
Brand Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font