bash
npm install @hua-labs/huatsx
import { VideoBackground } from "@hua-labs/ui/advanced";Native Video
MP4, WebM, Ogg
type="native"YouTube
type="youtube"Vimeo
type="vimeo"Solid Overlay
overlay overlayColor="rgba(0,0,0,0.4)"Gradient Overlay
gradient gradientDirection="bottom"- •
- •
- •
- •
- •
- •
- •
src* | string | - | docs:components.videoBackground.props.src |
type | "native" | "youtube" | "vimeo" | "native" | docs:components.videoBackground.props.type |
poster | string | - | docs:components.videoBackground.props.poster |
autoPlay | boolean | true | docs:components.videoBackground.props.autoPlay |
loop | boolean | true | docs:components.videoBackground.props.loop |
muted | boolean | true | docs:components.videoBackground.props.muted |
controls | boolean | false | docs:components.videoBackground.props.controls |
objectFit | "cover" | "contain" | "fill" | "cover" | docs:components.videoBackground.props.objectFit |
overlay | boolean | true | docs:components.videoBackground.props.overlay |
overlayColor | string | "rgba(0, 0, 0, 0.4)" | docs:components.videoBackground.props.overlayColor |
gradient | boolean | false | docs:components.videoBackground.props.gradient |
gradientDirection | "top" | "bottom" | "both" | "bottom" | docs:components.videoBackground.props.gradientDirection |
playbackRate | number | 1 | docs:components.videoBackground.props.playbackRate |
fadeIn | boolean | true | docs:components.videoBackground.props.fadeIn |
Native Video
import { VideoBackground } from '@hua-labs/ui/advanced';
<VideoBackground
src="/hero-video.mp4"
overlay
gradient
gradientDirection="bottom"
>
<HeroContent />
</VideoBackground>YouTube
<VideoBackground
type="youtube"
src="W0LHTWG-UmQ" // ISS Earth Timelapse
overlay
overlayColor="rgba(0, 0, 50, 0.6)"
/>Vimeo
<VideoBackground
type="vimeo"
src="123456789"
gradient
gradientDirection="both"
/>- •docs:components.videoBackground.accessibility.decorativeContent: docs:components.videoBackground.accessibility.decorativeContentDesc
- •docs:components.videoBackground.accessibility.contentLayer: docs:components.videoBackground.accessibility.contentLayerDesc
- •docs:components.videoBackground.accessibility.posterFallback: docs:components.videoBackground.accessibility.posterFallbackDesc