Skip to content
Magic UI SolidMagicUI Solid

Video Text

A text component with a video background.

OCEAN
@/demos/VideoTextDemo.tsx
import { VideoText } from '@/registry/magicui/video-text'
export function VideoTextDemo() {
return (
<div class="relative h-50 w-full overflow-hidden">
<VideoText src="https://cdn.magicui.design/ocean-small.webm">
OCEAN
</VideoText>
</div>
)
}
Terminal window
pnpm dlx shadcn@latest add @magicui-solid/video-text
import { VideoText } from '@/components/magicui/video-text'
<div class="relative h-125 w-full overflow-hidden">
<VideoText src="https://cdn.magicui.design/ocean-small.webm">OCEAN</VideoText>
</div>
Prop Type Default Description
src string Required The video source URL
as ValidComponent "div" The element type to render for the text
children JSX.Element Required The content to display (will have the video “inside” it)
class string "" Additional class for the container
autoPlay boolean true Whether to autoplay the video
muted boolean true Whether to mute the video
loop boolean true Whether to loop the video
preload `"auto"`/`"metadata"`/`"none"` "auto" Whether to preload the video
fontSize string/number 20 Font size for the text mask
fontWeight string/number "bold" Font weight for the text mask
textAnchor string "middle" Text anchor for the text mask
dominantBaseline string "middle" Dominant baseline for the text mask
fontFamily string "sans-serif" Font family for the text mask

Original:

magicui.design/docs/components/video-text