labsUI

Clip Card

Video tile: AspectRatio thumbnail (16:9 or 9:16), duration Badge, watched Progress along the bottom, and a ContextMenu of actions.

npx @kznlabs/labsui add clip-card
Duration 0:42

Insane 1v4 clutch

12.4K views · 2 days ago

Duration 3:10

Boss fight, no hits

3.1K views · last week

Duration 0:18

Funniest fail

import { ClipCard } from "@/components/blocks/clip-card";import {  ContextMenuItem,  ContextMenuSeparator,} from "@/components/ui/context-menu";type Clip = {  id: string;  title: string;  duration: string;  thumb: string;  watched: number;};export function ClipList({  clips,  onPlay,  onDelete,}: {  clips: Clip[];  onPlay: (id: string) => void;  onDelete: (id: string) => void;}) {  return (    <div className="grid grid-cols-2 gap-3 md:grid-cols-4">      {clips.map((c) => (        <ClipCard          key={c.id}          title={c.title}          duration={c.duration}          watched={c.watched}          thumbnail={<img src={c.thumb} alt="" />}          actions={            <>              <ContextMenuItem onSelect={() => onPlay(c.id)}>                Play              </ContextMenuItem>              <ContextMenuSeparator />              <ContextMenuItem                variant="destructive"                onSelect={() => onDelete(c.id)}              >                Delete              </ContextMenuItem>            </>          }        />      ))}    </div>  );}

<ClipCard>

Video tile: thumbnail in an AspectRatio, duration Badge, watched Progress and a context menu.

  • duration*
    string

    "0:42".

  • title*
    string

    Clip name; also the accessible name of the card.

  • actions
    ReactNode

    Context menu items (<ContextMenuItem>s): right-click or Shift+F10 opens them.

  • meta
    ReactNode

    Small print under the title, e.g. "12.4K views · 2 days ago".

  • ratiodefault 16 / 9
    number

    Width/height, e.g. 9 / 16 for vertical clips.

  • thumbnail
    ReactNode

    <img> thumbnail; a film glyph stands in without one.

  • watched
    number

    How much was watched, 0 to 100: a thin bar along the bottom of the thumbnail.

PropTypeDefault
duration*

"0:42".

string—
title*

Clip name; also the accessible name of the card.

string—
actions

Context menu items (<ContextMenuItem>s): right-click or Shift+F10 opens them.

ReactNode—
meta

Small print under the title, e.g. "12.4K views · 2 days ago".

ReactNode—
ratio

Width/height, e.g. 9 / 16 for vertical clips.

number16 / 9
thumbnail

<img> thumbnail; a film glyph stands in without one.

ReactNode—
watched

How much was watched, 0 to 100: a thin bar along the bottom of the thumbnail.

number—

* required. Every component also takes className.