Skip to content

Video

Video player supporting YouTube, Vimeo embeds, and native HTML5 video. Detects provider from URL and builds the correct embed.

Import

import { Video } from "@hyzer-labs/ui"

Demo

Every ratio below plays the same source file. The aspect box is the component's own: the footage letterboxes or pillarboxes inside whatever ratio the prop declares.

<Video src="/hero.mp4" title="A card composed from the library" />

Props

NameTypeDefaultNote
srcstringRequired. Native file URL, or a YouTube/Vimeo URL — the provider is detected and the right embed is built.
titlestringRequired for accessibility.
aspectRatio'16/9' | '4/3' | '1/1' | '9/16''16/9'
autoplaybooleanfalseRequires muted; suppressed under prefers-reduced-motion.
mutedbooleanfalse
controlsbooleantrue
loopbooleanfalse
posterstringNative provider only.
loading'lazy' | 'eager''lazy'
classstringMerged after the hz-video class.

Theme hooks

What this component promises your CSS. The reference theme styles exactly these — from @layer hz-theme, so your unlayered rules win. See Styling Components for the how.

Root class: .hz-video

Data attributes

HookValuesStyles
data-provider'youtube' | 'vimeo' | 'native'Detected from src. Styling hook for provider-specific chrome.
data-aspect-ratio'16/9' | '4/3' | '1/1' | '9/16'Mirrors the prop; the ratio lands as an inline style. Closed union — unlike Image, there is no auto. Default 16/9.
data-state'idle' | 'playing' | 'paused' | 'ended'Read-only playback state. Native embeds only — a YouTube or Vimeo iframe stays idle, because the provider owns those controls.

Part classes

HookValuesStyles
.hz-video__elchild elementThe player — the iframe or the native video, whichever the src resolved to. One class across all three branches, so it fills the ratio box either way.

Accessibility

The title prop is required and maps to the iframe title or video aria-label. autoplay requires muted, both because browsers refuse to autoplay sound and because motion a reader did not ask for is disorienting.

References: MDN: <video>