Media Text

Text filled with an image or video, creating a clipping mask effect.

Import

import { MediaText } from "@igorao79/uivix";

Playground

AMAZING

Examples

Image fill

<MediaText
  src="/ocean.jpg"
  className="text-6xl font-black"
>
  OCEAN
</MediaText>

OCEAN

Video fill

<MediaText
  videoSrc="/my-video.mp4"
  className="text-6xl font-black text-white"
>
  WAVES
</MediaText>

Pass a videoSrc prop with a local or hosted video URL. The video will play inside the text using a mix-blend-mode technique.

Props

PropTypeDefaultDescription
childrenstring-The text content (required)
srcstring-Image URL to fill the text
videoSrcstring-Video URL to fill the text
backgroundSizestring"cover"CSS background-size (image mode)
backgroundPositionstring"center"CSS background-position (image mode)
loopbooleantrueLoop video (video mode)
mutedbooleantrueMute video (video mode)
asElementType"h1"HTML tag to render
classNamestring-Additional CSS classes