Video

A film in the page: its still under a play button, playing in place with its controls once pressed.

A flower opening in time-lapse
import { Video } from "@produkto/ui/Video";

const Example = () => (
  <Video
    src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4"
    poster="https://picsum.photos/id/106/1600/900"
    alt="A flower opening in time-lapse"
    className="max-w-2xl"
  />
);

export default Example;

Usage

import { Video } from "@produkto/ui/Video";
<Video src="/film.mp4" poster="/still.jpg" alt="A flower opening in time-lapse" />

<Video mode="ground" src="/film.mp4" poster="/still.jpg" alt="A flower opening in time-lapse" />

<Video mode="large" src="/film.mp4" poster="/still.jpg" alt="A flower opening in time-lapse" />

Examples

Border radius

borderRadius sets the corners of its frame in the page and in large mode on the kit's one scale: none, xs 4px, sm 6px, base 8px, lg 12px or xl 16px (the default); behind the words its frame takes none, the box it fills keeping its own corners.

A flower opening in time-lapse
A flower opening in time-lapse
A flower opening in time-lapse
A flower opening in time-lapse
A flower opening in time-lapse
A flower opening in time-lapse
import { Label } from "@produkto/ui/Label";
import { Video, type VideoBorderRadius } from "@produkto/ui/Video";

const variants: { borderRadius: VideoBorderRadius; label: string }[] = [
  { borderRadius: "none", label: "None" },
  { borderRadius: "xs", label: "xs" },
  { borderRadius: "sm", label: "sm" },
  { borderRadius: "base", label: "base" },
  { borderRadius: "lg", label: "lg" },
  { borderRadius: "xl", label: "xl" },
];

const src =
  "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4";

const poster = "https://picsum.photos/id/106/1600/900";

const alt = "A flower opening in time-lapse";

const Example = () => (
  <div className="grid w-full max-w-2xl gap-4 sm:grid-cols-3">
    {variants.map((variant) => (
      <div className="flex flex-col gap-2" key={variant.borderRadius}>
        <Label>{variant.label}</Label>
        <Video
          alt={alt}
          poster={poster}
          borderRadius={variant.borderRadius}
          src={src}
        />
      </div>
    ))}
  </div>
);

export default Example;

Mode

mode sets how the film plays: page, the default, in place under its still; ground, looping muted behind the words in the box it fills; large, opening over the page.

A flower opening in time-lapse
A flower opening in time-lapse
import { Video } from "@produkto/ui/Video";

const src =
  "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4";

const poster = "https://picsum.photos/id/106/1600/900";

const alt = "A flower opening in time-lapse";

const Example = () => (
  <div className="grid w-full max-w-2xl gap-4 sm:grid-cols-3">
    <Video alt={alt} poster={poster} src={src} />
    <div className="relative aspect-video overflow-hidden rounded-2xl">
      <Video alt={alt} mode="ground" poster={poster} src={src} />
    </div>
    <Video alt={alt} mode="large" poster={poster} src={src} />
  </div>
);

export default Example;

API Reference

Video

VideoProps · components/Video/Video.types.ts
PropTypeDefault
srcrequiredstring-
posterrequiredstring-
altrequiredstring-
modeVideoMode"page" | "ground" | "large""page"
borderRadiusVideoBorderRadius"none" | "xs" | "sm" | "base" | "lg" | "xl""xl"
classNamestring-