Skip to content
ui8kit

block / marketing

Video Grid

Customer videos as thumbnails with a play button. Playing is a port contract (VideoEmbed).

Install

npx ui8kit add video-grid

Pulls in: box, button, compose, empty-state, figure-block, grid, kit-box, kit-button, kit-text, lucide-icon, media-frame, section-frame, testimonial-grid, text, utils

Preview

Hear it from customers

Mara Quinn

Head of Growth, Lumen

Jon Ellis

Engineering Lead, Harbor

Aya Tanaka

Product Designer, Summit

Luis Ortega

Operations, Orbit

Code

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdn
npx ui8kit add video-grid
blocks/video-grid.svelte
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  Video testimonials as thumbnails: a picture, a play button, the name and the company. The player is a port
  contract (VideoEmbed); here the button emits `play`. Axes: columns (2, 3), caption (below, overlay), tone,
  density.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Quote } from "./testimonial-grid.types";

  export type VideoGridProps = {
    id: string;
    title: string;
    quotes: Quote[];
    empty?: string;
    playLabel: string;
    byLine: string;
    cols?: "1-2" | "1-3";
    caption?: "below" | "overlay";
    tone?: "default" | "muted";
    density?: "default" | "compact";
    landmarkLabel?: string;
    onplay?: (id: string) => void;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Button from "../compose/Button.svelte";
  import Grid from "../compose/Grid.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Text from "../compose/Text.svelte";
  import EmptyState from "../components/empty-state.svelte";
  import FigureBlock from "../components/figure-block.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { tpl } from "../utils";

  let {
    id,
    title,
    quotes,
    empty = "",
    playLabel,
    byLine,
    cols = "1-3",
    caption = "below",
    tone = "default",
    density = "default",
    landmarkLabel,
    onplay,
  }: VideoGridProps = $props();
</script>

<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
  {#if ((quotes?.length ?? 0) === 0)}
    <EmptyState icon="video" title={empty} />
  {:else}
    <Grid cols={cols} class="gap-4" data-slot="items">
      {#each quotes as q (q.id)}
        <FigureBlock class="m-0 flex flex-col gap-4" testid="item">
          <Box class="relative">
            <MediaFrame alt={q.author} src={q.image} />
            <Button
              variant="default"
              size="default"
              type="button"
              class="absolute top-1/2 left-1/2 size-12 -translate-x-1/2 -translate-y-1/2 rounded p-0"
              aria-label={tpl(playLabel, q.author)}
              onclick={() => onplay?.(q.id)}
            >
              <LucideIcon name="play" size={20} />
            </Button>
            {#if ((caption as string) === "overlay")}
              <Box class="absolute inset-x-0 bottom-0 rounded bg-background p-4" data-slot="caption">
                <Text size="sm" weight="semibold">
                  {q.author}
                </Text>
                <Text size="xs" class="text-muted-foreground">
                  {tpl(byLine, q.role, q.company)}
                </Text>
              </Box>
            {/if}
          </Box>
          {#if ((caption as string) === "below")}
            <Text tag="figcaption" data-slot="caption">
              <Text size="sm" weight="semibold">
                {q.author}
              </Text>
              <Text size="xs" class="text-muted-foreground">
                {tpl(byLine, q.role, q.company)}
              </Text>
            </Text>
          {/if}
        </FigureBlock>
      {/each}
    </Grid>
  {/if}
</SectionFrame>

Svelte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdn
npx ui8kit add video-grid
blocks/video-grid.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * Video testimonials as thumbnails: a picture, a play button, the name and the company. The player is a port
 * contract (VideoEmbed); here the button emits `play`. Axes: columns (2, 3), caption (below, overlay), tone,
 * density.
 */
import { type ReactNode } from "react";
import { Box, Button, Grid, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { FigureBlock } from "../components/figure-block";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { tpl } from "../utils";
import type { Quote } from "./testimonial-grid.types";

export type VideoGridProps = {
  id: string;
  title: string;
  quotes: Quote[];
  empty?: string;
  playLabel: string;
  byLine: string;
  cols?: "1-2" | "1-3";
  caption?: "below" | "overlay";
  tone?: "default" | "muted";
  density?: "default" | "compact";
  landmarkLabel?: string;
  onPlay?: (id: string) => void;
};

export function VideoGrid({
  id,
  title,
  quotes,
  empty = "",
  playLabel,
  byLine,
  cols = "1-3",
  caption = "below",
  tone = "default",
  density = "default",
  landmarkLabel,
  onPlay,
}: VideoGridProps) {
  return (
    <SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
      {((quotes?.length ?? 0) === 0) ? (
        <EmptyState icon="video" title={empty} />
      ) : (
        <Grid cols={cols} className="gap-4" data-slot="items">
          {(quotes ?? []).map((q) => (
            <FigureBlock key={q.id} className="m-0 flex flex-col gap-4" testid="item">
              <Box className="relative">
                <MediaFrame alt={q.author} src={q.image} />
                <Button
                  variant="default"
                  size="default"
                  type="button"
                  className="absolute top-1/2 left-1/2 size-12 -translate-x-1/2 -translate-y-1/2 rounded p-0"
                  aria-label={tpl(playLabel, q.author)}
                  onClick={() => onPlay?.(q.id)}
                >
                  <LucideIcon name="play" size={20} />
                </Button>
                {((caption as string) === "overlay") ? (
                  <Box className="absolute inset-x-0 bottom-0 rounded bg-background p-4" data-slot="caption">
                    <Text size="sm" weight="semibold">
                      {q.author}
                    </Text>
                    <Text size="xs" className="text-muted-foreground">
                      {tpl(byLine, q.role, q.company)}
                    </Text>
                  </Box>
                ) : null}
              </Box>
              {((caption as string) === "below") ? (
                <Text tag="figcaption" data-slot="caption">
                  <Text size="sm" weight="semibold">
                    {q.author}
                  </Text>
                  <Text size="xs" className="text-muted-foreground">
                    {tpl(byLine, q.role, q.company)}
                  </Text>
                </Text>
              ) : null}
            </FigureBlock>
          ))}
        </Grid>
      )}
    </SectionFrame>
  );
}

React registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdn
npx ui8kit add video-grid
blocks/video-grid.vue
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  Video testimonials as thumbnails: a picture, a play button, the name and the company. The player is a port
  contract (VideoEmbed); here the button emits `play`. Axes: columns (2, 3), caption (below, overlay), tone,
  density.
-->
<script lang="ts">
import type { Quote } from "./testimonial-grid.types";

export type VideoGridProps = {
  id: string;
  title: string;
  quotes: Quote[];
  empty?: string;
  playLabel: string;
  byLine: string;
  cols?: "1-2" | "1-3";
  caption?: "below" | "overlay";
  tone?: "default" | "muted";
  density?: "default" | "compact";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Button from "../compose/Button.vue";
import Grid from "../compose/Grid.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Text from "../compose/Text.vue";
import EmptyState from "../components/empty-state.vue";
import FigureBlock from "../components/figure-block.vue";
import MediaFrame from "../components/media-frame.vue";
import SectionFrame from "../components/section-frame.vue";
import { tpl } from "../utils";

const {
  id,
  title,
  quotes,
  empty = "",
  playLabel,
  byLine,
  cols = "1-3",
  caption = "below",
  tone = "default",
  density = "default",
  landmarkLabel,
} = defineProps<VideoGridProps>();
const emit = defineEmits<{ play: [id: string] }>();
</script>

<template>
  <SectionFrame :id="id" :title="title" :tone="tone" :density="density" :landmarkLabel="landmarkLabel">
    <EmptyState v-if="((quotes?.length ?? 0) === 0)" icon="video" :title="empty" />
    <Grid v-else :cols="cols" class="gap-4" data-slot="items">
      <FigureBlock v-for="q in quotes" :key="q.id" class="m-0 flex flex-col gap-4" testid="item">
        <Box class="relative">
          <MediaFrame :alt="q.author" :src="q.image" />
          <Button
            variant="default"
            size="default"
            type="button"
            class="absolute top-1/2 left-1/2 size-12 -translate-x-1/2 -translate-y-1/2 rounded p-0"
            :aria-label="tpl(playLabel, q.author)"
            @click="() => emit('play', q.id)"
          >
            <LucideIcon name="play" :size="20" />
          </Button>
          <Box
            v-if="((caption as string) === 'overlay')"
            class="absolute inset-x-0 bottom-0 rounded bg-background p-4"
            data-slot="caption"
          >
            <Text size="sm" weight="semibold">
              {{ q.author }}
            </Text>
            <Text size="xs" class="text-muted-foreground">
              {{ tpl(byLine, q.role, q.company) }}
            </Text>
          </Box>
        </Box>
        <Text v-if="((caption as string) === 'below')" tag="figcaption" data-slot="caption">
          <Text size="sm" weight="semibold">
            {{ q.author }}
          </Text>
          <Text size="xs" class="text-muted-foreground">
            {{ tpl(byLine, q.role, q.company) }}
          </Text>
        </Text>
      </FigureBlock>
    </Grid>
  </SectionFrame>
</template>

Vue registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdn
npx ui8kit add video-grid
blocks/video-grid.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * Video testimonials as thumbnails: a picture, a play button, the name and the company. The player is a port
 * contract (VideoEmbed); here the button emits `play`. Axes: columns (2, 3), caption (below, overlay), tone,
 * density.
 */
import { For, type JSX } from "solid-js";
import { Box, Button, Grid, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { FigureBlock } from "../components/figure-block";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { tpl } from "../utils";
import type { Quote } from "./testimonial-grid.types";

export type VideoGridProps = {
  id: string;
  title: string;
  quotes: Quote[];
  empty?: string;
  playLabel: string;
  byLine: string;
  cols?: "1-2" | "1-3";
  caption?: "below" | "overlay";
  tone?: "default" | "muted";
  density?: "default" | "compact";
  landmarkLabel?: string;
  onPlay?: (id: string) => void;
};

export function VideoGrid({
  id,
  title,
  quotes,
  empty = "",
  playLabel,
  byLine,
  cols = "1-3",
  caption = "below",
  tone = "default",
  density = "default",
  landmarkLabel,
  onPlay,
}: VideoGridProps) {
  return (
    <SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>
      {((quotes?.length ?? 0) === 0) ? (
        <EmptyState icon="video" title={empty} />
      ) : (
        <Grid cols={cols} class="gap-4" data-slot="items">
          <For each={quotes ?? []}>{(q) => (
            <FigureBlock class="m-0 flex flex-col gap-4" testid="item">
              <Box class="relative">
                <MediaFrame alt={q.author} src={q.image} />
                <Button
                  variant="default"
                  size="default"
                  type="button"
                  class="absolute top-1/2 left-1/2 size-12 -translate-x-1/2 -translate-y-1/2 rounded p-0"
                  aria-label={tpl(playLabel, q.author)}
                  onClick={() => onPlay?.(q.id)}
                >
                  <LucideIcon name="play" size={20} />
                </Button>
                {((caption as string) === "overlay") ? (
                  <Box class="absolute inset-x-0 bottom-0 rounded bg-background p-4" data-slot="caption">
                    <Text size="sm" weight="semibold">
                      {q.author}
                    </Text>
                    <Text size="xs" class="text-muted-foreground">
                      {tpl(byLine, q.role, q.company)}
                    </Text>
                  </Box>
                ) : null}
              </Box>
              {((caption as string) === "below") ? (
                <Text tag="figcaption" data-slot="caption">
                  <Text size="sm" weight="semibold">
                    {q.author}
                  </Text>
                  <Text size="xs" class="text-muted-foreground">
                    {tpl(byLine, q.role, q.company)}
                  </Text>
                </Text>
              ) : null}
            </FigureBlock>
          )}</For>
        </Grid>
      )}
    </SectionFrame>
  );
}

Solid registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdn
npx ui8kit add video-grid
blocks/video-grid.templ
// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/organisms/video-grid.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/ui/button"
	"github.com/ui8kit/codegen/generated/templ/compose"
	"github.com/ui8kit/codegen/generated/templ/icons"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// VideoGridProps are the props of VideoGrid; the values are the JSON shapes of the TypeScript props.
type VideoGridProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Quotes any `json:"quotes"`
	Empty any `json:"empty"`
	PlayLabel any `json:"playLabel"`
	ByLine any `json:"byLine"`
	Cols any `json:"cols"`
	Caption any `json:"caption"`
	Tone any `json:"tone"`
	Density any `json:"density"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// Video testimonials as thumbnails: a picture, a play button, the name and the company. The player is a port contract (VideoEmbed); here the button emits `play`. Axes: columns (2, 3), caption (below, overlay), tone, density.
templ VideoGrid(p VideoGridProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vQuotes := p.Quotes }}
	{{ vEmpty := uiutils.Def(p.Empty, "") }}
	{{ vPlayLabel := p.PlayLabel }}
	{{ vByLine := p.ByLine }}
	{{ vCols := uiutils.Def(p.Cols, "1-3") }}
	{{ vCaption := uiutils.Def(p.Caption, "below") }}
	{{ vTone := uiutils.Def(p.Tone, "default") }}
	{{ vDensity := uiutils.Def(p.Density, "default") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, Density: vDensity, LandmarkLabel: vLandmarkLabel}) {
		if uiutils.Eq(uiutils.Len(vQuotes), float64(0)) {
			@EmptyState(EmptyStateProps{Icon: "video", Title: vEmpty})
		} else {
			@compose.Grid(compose.GridProps{Cols: uiutils.S(vCols), BoxProps: box.BoxProps{Class: "gap-4", Attrs: uiutils.Attrs("data-slot", "items")}}) {
				for _, vQ := range uiutils.L(vQuotes) {
					@FigureBlock(FigureBlockProps{Class: uiutils.Cnv("m-0 flex flex-col gap-4"), Testid: "item"}) {
						@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "relative"}}) {
							@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vQ, "author"), Src: uiutils.Get(vQ, "image")})
							@compose.Button(compose.ButtonProps{Variant: "default", Size: "default", ButtonProps: button.ButtonProps{Type: "button", Class: "absolute top-1/2 left-1/2 size-12 -translate-x-1/2 -translate-y-1/2 rounded p-0", Attrs: uiutils.Attrs("aria-label", uiutils.Tpl(vPlayLabel, uiutils.Get(vQ, "author")))}}) {
								@icons.LucideIcon(icons.LucideIconProps{Name: "play", Size: 20})
							}
							if uiutils.Eq(vCaption, "overlay") {
								@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "absolute inset-x-0 bottom-0 rounded bg-background p-4", Attrs: uiutils.Attrs("data-slot", "caption")}}) {
									@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
										{ uiutils.Text(uiutils.Get(vQ, "author")) }
									}
									@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
										{ uiutils.Text(uiutils.Tpl(vByLine, uiutils.Get(vQ, "role"), uiutils.Get(vQ, "company"))) }
									}
								}
							}
						}
						if uiutils.Eq(vCaption, "below") {
							@compose.Text(compose.TextProps{TextProps: text.TextProps{Tag: "figcaption", Attrs: uiutils.Attrs("data-slot", "caption")}}) {
								@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
									{ uiutils.Text(uiutils.Get(vQ, "author")) }
								}
								@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
									{ uiutils.Text(uiutils.Tpl(vByLine, uiutils.Get(vQ, "role"), uiutils.Get(vQ, "company"))) }
								}
							}
						}
					}
				}
			}
		}
	}
}

templ registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdn
npx ui8kit add video-grid
blocks/video-grid.html.twig
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/video-grid.json
    Video testimonials as thumbnails: a picture, a play button, the name and the company. The player is a port contract (VideoEmbed); here the button emits `play`. Axes: columns (2, 3), caption (below, overlay), tone, density.
    Props (p): id, title, quotes, empty, playLabel, byLine, cols, caption, tone, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_quotes = (p.quotes ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_playLabel = (p.playLabel ?? null) -%}
{%- set v_byLine = (p.byLine ?? null) -%}
{%- set v_cols = (p.cols ?? '1-3') -%}
{%- set v_caption = (p.caption ?? 'below') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_11 -%}
  {%- if og_t(og_eq(og_len(v_quotes), 0)) %}
    {{ include('blocks/empty-state.html.twig', {'p': {'icon': 'video', 'title': v_empty}}, with_context = false) }}
  {%- else %}
    {%- set c_10 -%}
      {%- for v_q in og_l(v_quotes) %}
        {%- set c_9 -%}
          {%- set c_5 -%}
            {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_q, ['author']), 'src': og_get(v_q, ['image'])}}, with_context = false) }}
            {%- set c_1 -%}
              {{ include('icons/LucideIcon.html.twig', {'name': 'play', 'size': 20}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'default', 'type': 'button', 'class': 'absolute top-1/2 left-1/2 size-12 -translate-x-1/2 -translate-y-1/2 rounded p-0', 'attrs': og_attrs(['aria-label', og_tpl(v_playLabel, [og_get(v_q, ['author'])])]), 'children': c_1}, with_context = false) }}
            {%- if og_t(og_eq(v_caption, 'overlay')) %}
              {%- set c_4 -%}
                {%- set c_2 -%}
                  {{ og_text(og_get(v_q, ['author'])) }}
                {%- endset -%}
                {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_2}, with_context = false) }}
                {%- set c_3 -%}
                  {{ og_text(og_tpl(v_byLine, [og_get(v_q, ['role']), og_get(v_q, ['company'])])) }}
                {%- endset -%}
                {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
              {%- endset -%}
              {{ include('compose/Box.html.twig', {'class': 'absolute inset-x-0 bottom-0 rounded bg-background p-4', 'attrs': og_attrs(['data-slot', 'caption']), 'children': c_4}, with_context = false) }}
            {%- endif %}
          {%- endset -%}
          {{ include('compose/Box.html.twig', {'class': 'relative', 'children': c_5}, with_context = false) }}
          {%- if og_t(og_eq(v_caption, 'below')) %}
            {%- set c_8 -%}
              {%- set c_6 -%}
                {{ og_text(og_get(v_q, ['author'])) }}
              {%- endset -%}
              {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_6}, with_context = false) }}
              {%- set c_7 -%}
                {{ og_text(og_tpl(v_byLine, [og_get(v_q, ['role']), og_get(v_q, ['company'])])) }}
              {%- endset -%}
              {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_7}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'tag': 'figcaption', 'attrs': og_attrs(['data-slot', 'caption']), 'children': c_8}, with_context = false) }}
          {%- endif %}
        {%- endset -%}
        {{ include('blocks/figure-block.html.twig', {'p': {'className': og_cnv(['m-0 flex flex-col gap-4']), 'testid': 'item'}, 'children': og_markup(c_9)}, with_context = false) }}
      {%- endfor %}
    {%- endset -%}
    {{ include('compose/Grid.html.twig', {'cols': og_s(v_cols), 'class': 'gap-4', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_10}, with_context = false) }}
  {%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_11)}, with_context = false) }}

Twig registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdn
npx ui8kit add video-grid
blocks/video-grid.latte
{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/video-grid.json
    Video testimonials as thumbnails: a picture, a play button, the name and the company. The player is a port contract (VideoEmbed); here the button emits `play`. Axes: columns (2, 3), caption (below, overlay), tone, density.
    Props (p): id, title, quotes, empty, playLabel, byLine, cols, caption, tone, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_quotes = ($p['quotes'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_playLabel = ($p['playLabel'] ?? null)}
{var $v_byLine = ($p['byLine'] ?? null)}
{var $v_cols = ($p['cols'] ?? '1-3')}
{var $v_caption = ($p['caption'] ?? 'below')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_11}
  {if og_t(og_eq(og_len($v_quotes), 0))}
    {=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'video', 'title' => $v_empty]])|noescape}
  {else}
    {capture $c_10}
      {foreach og_l($v_quotes) as $v_q}
        {capture $c_9}
          {capture $c_5}
            {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_q, ['author']), 'src' => og_get($v_q, ['image'])]])|noescape}
            {capture $c_1}
              {=og_include('icons/LucideIcon.latte', ['name' => 'play', 'size' => 20])|noescape}
            {/capture}
            {=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'default', 'type' => 'button', 'class' => 'absolute top-1/2 left-1/2 size-12 -translate-x-1/2 -translate-y-1/2 rounded p-0', 'attrs' => og_attrs(['aria-label', og_tpl($v_playLabel, [og_get($v_q, ['author'])])]), 'children' => (string) $c_1])|noescape}
            {if og_t(og_eq($v_caption, 'overlay'))}
              {capture $c_4}
                {capture $c_2}
                  {=og_text(og_get($v_q, ['author']))}
                {/capture}
                {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_2])|noescape}
                {capture $c_3}
                  {=og_text(og_tpl($v_byLine, [og_get($v_q, ['role']), og_get($v_q, ['company'])]))}
                {/capture}
                {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
              {/capture}
              {=og_include('compose/Box.latte', ['class' => 'absolute inset-x-0 bottom-0 rounded bg-background p-4', 'attrs' => og_attrs(['data-slot', 'caption']), 'children' => (string) $c_4])|noescape}
            {/if}
          {/capture}
          {=og_include('compose/Box.latte', ['class' => 'relative', 'children' => (string) $c_5])|noescape}
          {if og_t(og_eq($v_caption, 'below'))}
            {capture $c_8}
              {capture $c_6}
                {=og_text(og_get($v_q, ['author']))}
              {/capture}
              {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_6])|noescape}
              {capture $c_7}
                {=og_text(og_tpl($v_byLine, [og_get($v_q, ['role']), og_get($v_q, ['company'])]))}
              {/capture}
              {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_7])|noescape}
            {/capture}
            {=og_include('compose/Text.latte', ['tag' => 'figcaption', 'attrs' => og_attrs(['data-slot', 'caption']), 'children' => (string) $c_8])|noescape}
          {/if}
        {/capture}
        {=og_include('blocks/figure-block.latte', ['p' => ['className' => og_cnv(['m-0 flex flex-col gap-4']), 'testid' => 'item'], 'children' => og_markup($c_9)])|noescape}
      {/foreach}
    {/capture}
    {=og_include('compose/Grid.latte', ['cols' => og_s($v_cols), 'class' => 'gap-4', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_10])|noescape}
  {/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'density' => $v_density, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_11)])|noescape}

Latte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdn
npx ui8kit add video-grid
blocks/video-grid.html.j2
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/video-grid.json
    Video testimonials as thumbnails: a picture, a play button, the name and the company. The player is a port contract (VideoEmbed); here the button emits `play`. Axes: columns (2, 3), caption (below, overlay), tone, density.
    Props (p): id, title, quotes, empty, playLabel, byLine, cols, caption, tone, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_quotes = og_def(p['quotes'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_playLabel = og_def(p['playLabel'], none) -%}
{%- set v_byLine = og_def(p['byLine'], none) -%}
{%- set v_cols = og_def(p['cols'], '1-3') -%}
{%- set v_caption = og_def(p['caption'], 'below') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_11 -%}
  {%- if og_t(og_eq(og_len(v_quotes), 0)) %}
    {{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'video', 'title': v_empty}}) }}
  {%- else %}
    {%- set c_10 -%}
      {%- for v_q in og_l(v_quotes) %}
        {%- set c_9 -%}
          {%- set c_5 -%}
            {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_q, ['author']), 'src': og_get(v_q, ['image'])}}) }}
            {%- set c_1 -%}
              {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'play', 'Size': 20}}) }}
            {%- endset -%}
            {{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'default', 'Type': 'button', 'Class': 'absolute top-1/2 left-1/2 size-12 -translate-x-1/2 -translate-y-1/2 rounded p-0', 'Attrs': og_attrs(['aria-label', og_tpl(v_playLabel, [og_get(v_q, ['author'])])])}, 'children': c_1}) }}
            {%- if og_t(og_eq(v_caption, 'overlay')) %}
              {%- set c_4 -%}
                {%- set c_2 -%}
                  {{ og_text(og_get(v_q, ['author'])) }}
                {%- endset -%}
                {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_2}) }}
                {%- set c_3 -%}
                  {{ og_text(og_tpl(v_byLine, [og_get(v_q, ['role']), og_get(v_q, ['company'])])) }}
                {%- endset -%}
                {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
              {%- endset -%}
              {{ og_include('compose/box.html.j2', {'p': {'Class': 'absolute inset-x-0 bottom-0 rounded bg-background p-4', 'Attrs': og_attrs(['data-slot', 'caption'])}, 'children': c_4}) }}
            {%- endif %}
          {%- endset -%}
          {{ og_include('compose/box.html.j2', {'p': {'Class': 'relative'}, 'children': c_5}) }}
          {%- if og_t(og_eq(v_caption, 'below')) %}
            {%- set c_8 -%}
              {%- set c_6 -%}
                {{ og_text(og_get(v_q, ['author'])) }}
              {%- endset -%}
              {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_6}) }}
              {%- set c_7 -%}
                {{ og_text(og_tpl(v_byLine, [og_get(v_q, ['role']), og_get(v_q, ['company'])])) }}
              {%- endset -%}
              {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_7}) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Tag': 'figcaption', 'Attrs': og_attrs(['data-slot', 'caption'])}, 'children': c_8}) }}
          {%- endif %}
        {%- endset -%}
        {{ og_include('blocks/figure-block.html.j2', {'p': {'className': og_cnv(['m-0 flex flex-col gap-4']), 'testid': 'item'}, 'children': og_markup(c_9)}) }}
      {%- endfor %}
    {%- endset -%}
    {{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(v_cols), 'Class': 'gap-4', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_10}) }}
  {%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_11)}) }}

Jinja2 registry item (JSON)

Props

Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.

Video testimonials as thumbnails: a picture, a play button, the name and the company. The player is a port contract (VideoEmbed); here the button emits `play`. Axes: columns (2, 3), caption (below, overlay), tone, density.

Props of VideoGrid
PropTypeDefault Description
id (required)string-
title (required)string-
quotes (required)Quote[]-
empty string""the text of the empty state (no records), from the dictionary
playLabel (required)string-template of the play button's name, e.g. `Play the video from {0}`
byLine (required)string-template of the line under the name: `{0}, {1}` (role, company)
cols "1-2" | "1-3""1-3"
caption "below" | "overlay""below"
tone "default" | "muted""default"
density "default" | "compact""default"
landmarkLabel string-accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one