Skip to content
ui8kit

block / onboarding

Video Modal

A dialog with a walkthrough video and an optional list of chapters. Opening and playing are port contracts.

Install

npx ui8kit add video-modal

Pulls in: box, button, compose, group, kit-box, kit-button, kit-text, list, list-item, lucide-icon, media-frame, section-frame, stack, text, title, utils

Preview

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-modal
blocks/video-modal.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. -->
<!--
  A dialog with a walkthrough video: a title and a close button, the player area with a play button and,
  optionally, a list of chapters. Opening the dialog and playing the video are port contracts. Axes: size
  (default, wide), outline (none, chapters: a list under the player), tone.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Chapter } from "./video-modal.types";

  export type VideoModalProps = {
    id: string;
    title: string;
    text: string;
    close: string;
    play: string;
    chaptersTitle: string;
    chapters: Chapter[];
    size?: "default" | "wide";
    outline?: "none" | "chapters";
    tone?: "default" | "muted";
    image?: string;
    imageAlt?: string;
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Button from "../compose/Button.svelte";
  import Group from "../compose/Group.svelte";
  import List from "../compose/List.svelte";
  import ListItem from "../compose/ListItem.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import Title from "../compose/Title.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { cn } from "../utils";

  let {
    id,
    title,
    text,
    close,
    play,
    chaptersTitle,
    chapters,
    size = "default",
    outline = "none",
    tone = "default",
    image,
    imageAlt,
    landmarkLabel,
  }: VideoModalProps = $props();
</script>

<SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
  <Stack
    gap="4"
    align="stretch"
    class={cn(
      "mx-auto w-full",
      (((size as string) === "wide") ? "max-w-4xl" : "max-w-2xl"),
      "rounded bg-card inset-ring inset-ring-border p-4 shadow-lg"
    )}
    role="dialog"
    aria-label={title}
    data-slot="video-modal"
  >
    <Group gap="2" align="center" justify="between">
      <Text size="sm" class="text-muted-foreground">
        {text}
      </Text>
      <Button variant="ghost" size="sm" type="button" class="shrink-0" aria-label={close}>
        <LucideIcon name="x" size={16} />
      </Button>
    </Group>
    <Box class="relative" data-slot="player">
      <MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} />
      <Button
        variant="default"
        size="default"
        type="button"
        class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded"
        aria-label={play}
      >
        <LucideIcon name="play" size={24} />
      </Button>
    </Box>
    {#if (((outline as string) === "chapters") && ((chapters?.length ?? 0) > 0))}
      <Stack gap="2" data-slot="chapters">
        <Title as={3} size="base" weight="bold">
          {chaptersTitle}
        </Title>
        <List class="m-0 flex list-none flex-col gap-2 p-0">
          {#each chapters as c (c.id)}
            <ListItem class="flex items-baseline gap-4" data-slot="item">
              <Text size="sm" weight="semibold">
                {c.title}
              </Text>
              <Text size="xs" class="text-muted-foreground">
                {c.text}
              </Text>
            </ListItem>
          {/each}
        </List>
      </Stack>
    {/if}
  </Stack>
</SectionFrame>
blocks/video-modal.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Chapter = {
  id: string;
  title: string;
  text: string;
};

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-modal
blocks/video-modal.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.
/**
 * A dialog with a walkthrough video: a title and a close button, the player area with a play button and,
 * optionally, a list of chapters. Opening the dialog and playing the video are port contracts. Axes: size
 * (default, wide), outline (none, chapters: a list under the player), tone.
 */
import { type ReactNode } from "react";
import { Box, Button, Group, List, ListItem, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { cn } from "../utils";
import type { Chapter } from "./video-modal.types";

export type VideoModalProps = {
  id: string;
  title: string;
  text: string;
  close: string;
  play: string;
  chaptersTitle: string;
  chapters: Chapter[];
  size?: "default" | "wide";
  outline?: "none" | "chapters";
  tone?: "default" | "muted";
  image?: string;
  imageAlt?: string;
  landmarkLabel?: string;
};

export function VideoModal({
  id,
  title,
  text,
  close,
  play,
  chaptersTitle,
  chapters,
  size = "default",
  outline = "none",
  tone = "default",
  image,
  imageAlt,
  landmarkLabel,
}: VideoModalProps) {
  return (
    <SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
      <Stack
        gap="4"
        align="stretch"
        className={cn(
          "mx-auto w-full",
          (((size as string) === "wide") ? "max-w-4xl" : "max-w-2xl"),
          "rounded bg-card inset-ring inset-ring-border p-4 shadow-lg"
        )}
        role="dialog"
        aria-label={title}
        data-slot="video-modal"
      >
        <Group gap="2" align="center" justify="between">
          <Text size="sm" className="text-muted-foreground">
            {text}
          </Text>
          <Button variant="ghost" size="sm" type="button" className="shrink-0" aria-label={close}>
            <LucideIcon name="x" size={16} />
          </Button>
        </Group>
        <Box className="relative" data-slot="player">
          <MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} />
          <Button
            variant="default"
            size="default"
            type="button"
            className="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded"
            aria-label={play}
          >
            <LucideIcon name="play" size={24} />
          </Button>
        </Box>
        {(((outline as string) === "chapters") && ((chapters?.length ?? 0) > 0)) ? (
          <Stack gap="2" data-slot="chapters">
            <Title as={3} size="base" weight="bold">
              {chaptersTitle}
            </Title>
            <List className="m-0 flex list-none flex-col gap-2 p-0">
              {(chapters ?? []).map((c) => (
                <ListItem key={c.id} className="flex items-baseline gap-4" data-slot="item">
                  <Text size="sm" weight="semibold">
                    {c.title}
                  </Text>
                  <Text size="xs" className="text-muted-foreground">
                    {c.text}
                  </Text>
                </ListItem>
              ))}
            </List>
          </Stack>
        ) : null}
      </Stack>
    </SectionFrame>
  );
}
blocks/video-modal.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Chapter = {
  id: string;
  title: string;
  text: string;
};

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-modal
blocks/video-modal.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Chapter = {
  id: string;
  title: string;
  text: string;
};
blocks/video-modal.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. -->
<!--
  A dialog with a walkthrough video: a title and a close button, the player area with a play button and,
  optionally, a list of chapters. Opening the dialog and playing the video are port contracts. Axes: size
  (default, wide), outline (none, chapters: a list under the player), tone.
-->
<script lang="ts">
import type { Chapter } from "./video-modal.types";

export type VideoModalProps = {
  id: string;
  title: string;
  text: string;
  close: string;
  play: string;
  chaptersTitle: string;
  chapters: Chapter[];
  size?: "default" | "wide";
  outline?: "none" | "chapters";
  tone?: "default" | "muted";
  image?: string;
  imageAlt?: string;
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Button from "../compose/Button.vue";
import Group from "../compose/Group.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import MediaFrame from "../components/media-frame.vue";
import SectionFrame from "../components/section-frame.vue";
import { cn } from "../utils";

const {
  id,
  title,
  text,
  close,
  play,
  chaptersTitle,
  chapters,
  size = "default",
  outline = "none",
  tone = "default",
  image,
  imageAlt,
  landmarkLabel,
} = defineProps<VideoModalProps>();
</script>

<template>
  <SectionFrame :id="id" :title="title" :tone="tone" :landmarkLabel="landmarkLabel">
    <Stack
      gap="4"
      align="stretch"
      :class="cn(
        'mx-auto w-full',
        (((size as string) === 'wide') ? 'max-w-4xl' : 'max-w-2xl'),
        'rounded bg-card inset-ring inset-ring-border p-4 shadow-lg'
      )"
      role="dialog"
      :aria-label="title"
      data-slot="video-modal"
    >
      <Group gap="2" align="center" justify="between">
        <Text size="sm" class="text-muted-foreground">
          {{ text }}
        </Text>
        <Button variant="ghost" size="sm" type="button" class="shrink-0" :aria-label="close">
          <LucideIcon name="x" :size="16" />
        </Button>
      </Group>
      <Box class="relative" data-slot="player">
        <MediaFrame :alt="(imageAlt ? imageAlt : title)" :src="image" />
        <Button
          variant="default"
          size="default"
          type="button"
          class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded"
          :aria-label="play"
        >
          <LucideIcon name="play" :size="24" />
        </Button>
      </Box>
      <Stack
        v-if="(((outline as string) === 'chapters') && ((chapters?.length ?? 0) > 0))"
        gap="2"
        data-slot="chapters"
      >
        <Title :as="3" size="base" weight="bold">
          {{ chaptersTitle }}
        </Title>
        <List class="m-0 flex list-none flex-col gap-2 p-0">
          <ListItem v-for="c in chapters" :key="c.id" class="flex items-baseline gap-4" data-slot="item">
            <Text size="sm" weight="semibold">
              {{ c.title }}
            </Text>
            <Text size="xs" class="text-muted-foreground">
              {{ c.text }}
            </Text>
          </ListItem>
        </List>
      </Stack>
    </Stack>
  </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-modal
blocks/video-modal.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.
/**
 * A dialog with a walkthrough video: a title and a close button, the player area with a play button and,
 * optionally, a list of chapters. Opening the dialog and playing the video are port contracts. Axes: size
 * (default, wide), outline (none, chapters: a list under the player), tone.
 */
import { For, type JSX } from "solid-js";
import { Box, Button, Group, List, ListItem, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { cn } from "../utils";
import type { Chapter } from "./video-modal.types";

export type VideoModalProps = {
  id: string;
  title: string;
  text: string;
  close: string;
  play: string;
  chaptersTitle: string;
  chapters: Chapter[];
  size?: "default" | "wide";
  outline?: "none" | "chapters";
  tone?: "default" | "muted";
  image?: string;
  imageAlt?: string;
  landmarkLabel?: string;
};

export function VideoModal({
  id,
  title,
  text,
  close,
  play,
  chaptersTitle,
  chapters,
  size = "default",
  outline = "none",
  tone = "default",
  image,
  imageAlt,
  landmarkLabel,
}: VideoModalProps) {
  return (
    <SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
      <Stack
        gap="4"
        align="stretch"
        class={cn(
          "mx-auto w-full",
          (((size as string) === "wide") ? "max-w-4xl" : "max-w-2xl"),
          "rounded bg-card inset-ring inset-ring-border p-4 shadow-lg"
        )}
        role="dialog"
        aria-label={title}
        data-slot="video-modal"
      >
        <Group gap="2" align="center" justify="between">
          <Text size="sm" class="text-muted-foreground">
            {text}
          </Text>
          <Button variant="ghost" size="sm" type="button" class="shrink-0" aria-label={close}>
            <LucideIcon name="x" size={16} />
          </Button>
        </Group>
        <Box class="relative" data-slot="player">
          <MediaFrame alt={(imageAlt ? imageAlt : title)} src={image} />
          <Button
            variant="default"
            size="default"
            type="button"
            class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded"
            aria-label={play}
          >
            <LucideIcon name="play" size={24} />
          </Button>
        </Box>
        {(((outline as string) === "chapters") && ((chapters?.length ?? 0) > 0)) ? (
          <Stack gap="2" data-slot="chapters">
            <Title as={3} size="base" weight="bold">
              {chaptersTitle}
            </Title>
            <List class="m-0 flex list-none flex-col gap-2 p-0">
              <For each={chapters ?? []}>{(c) => (
                <ListItem class="flex items-baseline gap-4" data-slot="item">
                  <Text size="sm" weight="semibold">
                    {c.title}
                  </Text>
                  <Text size="xs" class="text-muted-foreground">
                    {c.text}
                  </Text>
                </ListItem>
              )}</For>
            </List>
          </Stack>
        ) : null}
      </Stack>
    </SectionFrame>
  );
}
blocks/video-modal.types.ts
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.

export type Chapter = {
  id: string;
  title: string;
  text: string;
};

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-modal
blocks/video-modal.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-modal.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"
)

// VideoModalProps are the props of VideoModal; the values are the JSON shapes of the TypeScript props.
type VideoModalProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Text any `json:"text"`
	Close any `json:"close"`
	Play any `json:"play"`
	ChaptersTitle any `json:"chaptersTitle"`
	Chapters any `json:"chapters"`
	Size any `json:"size"`
	Outline any `json:"outline"`
	Tone any `json:"tone"`
	Image any `json:"image"`
	ImageAlt any `json:"imageAlt"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A dialog with a walkthrough video: a title and a close button, the player area with a play button and, optionally, a list of chapters. Opening the dialog and playing the video are port contracts. Axes: size (default, wide), outline (none, chapters: a list under the player), tone.
templ VideoModal(p VideoModalProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vText := p.Text }}
	{{ vClose := p.Close }}
	{{ vPlay := p.Play }}
	{{ vChaptersTitle := p.ChaptersTitle }}
	{{ vChapters := p.Chapters }}
	{{ vSize := uiutils.Def(p.Size, "default") }}
	{{ vOutline := uiutils.Def(p.Outline, "none") }}
	{{ vTone := uiutils.Def(p.Tone, "default") }}
	{{ vImage := p.Image }}
	{{ vImageAlt := p.ImageAlt }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, LandmarkLabel: vLandmarkLabel}) {
		@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("mx-auto w-full", uiutils.Cond(uiutils.T(uiutils.Eq(vSize, "wide")), "max-w-4xl", "max-w-2xl"), "rounded bg-card inset-ring inset-ring-border p-4 shadow-lg")), Attrs: uiutils.Attrs("role", "dialog", "aria-label", vTitle, "data-slot", "video-modal")}}) {
			@compose.Group(compose.GroupProps{Gap: "2", Align: "center", Justify: "between", BoxProps: box.BoxProps{}}) {
				@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
					{ uiutils.Text(vText) }
				}
				@compose.Button(compose.ButtonProps{Variant: "ghost", Size: "sm", ButtonProps: button.ButtonProps{Type: "button", Class: "shrink-0", Attrs: uiutils.Attrs("aria-label", vClose)}}) {
					@icons.LucideIcon(icons.LucideIconProps{Name: "x", Size: 16})
				}
			}
			@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "relative", Attrs: uiutils.Attrs("data-slot", "player")}}) {
				@MediaFrame(MediaFrameProps{Alt: uiutils.Cond(uiutils.T(vImageAlt), vImageAlt, vTitle), Src: vImage})
				@compose.Button(compose.ButtonProps{Variant: "default", Size: "default", ButtonProps: button.ButtonProps{Type: "button", Class: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded", Attrs: uiutils.Attrs("aria-label", vPlay)}}) {
					@icons.LucideIcon(icons.LucideIconProps{Name: "play", Size: 24})
				}
			}
			if uiutils.T(uiutils.And(uiutils.Eq(vOutline, "chapters"), uiutils.Gt(uiutils.Len(vChapters), float64(0)))) {
				@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "chapters")}}) {
					@compose.Title(compose.TitleProps{As: "3", Size: "base", Weight: "bold", TextProps: text.TextProps{}}) {
						{ uiutils.Text(vChaptersTitle) }
					}
					@compose.List(compose.ListProps{BoxProps: box.BoxProps{Class: "m-0 flex list-none flex-col gap-2 p-0"}}) {
						for _, vC := range uiutils.L(vChapters) {
							@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex items-baseline gap-4", Attrs: uiutils.Attrs("data-slot", "item")}}) {
								@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
									{ uiutils.Text(uiutils.Get(vC, "title")) }
								}
								@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
									{ uiutils.Text(uiutils.Get(vC, "text")) }
								}
							}
						}
					}
				}
			}
		}
	}
}

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-modal
blocks/video-modal.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-modal.json
    A dialog with a walkthrough video: a title and a close button, the player area with a play button and, optionally, a list of chapters. Opening the dialog and playing the video are port contracts. Axes: size (default, wide), outline (none, chapters: a list under the player), tone.
    Props (p): id, title, text, close, play, chaptersTitle, chapters, size, outline, tone, image, imageAlt, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_text = (p.text ?? null) -%}
{%- set v_close = (p.close ?? null) -%}
{%- set v_play = (p.play ?? null) -%}
{%- set v_chaptersTitle = (p.chaptersTitle ?? null) -%}
{%- set v_chapters = (p.chapters ?? null) -%}
{%- set v_size = (p.size ?? 'default') -%}
{%- set v_outline = (p.outline ?? 'none') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_image = (p.image ?? null) -%}
{%- set v_imageAlt = (p.imageAlt ?? null) -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_13 -%}
  {%- set c_12 -%}
    {%- set c_3 -%}
      {%- set c_1 -%}
        {{ og_text(v_text) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_1}, with_context = false) }}
      {%- set c_2 -%}
        {{ include('icons/LucideIcon.html.twig', {'name': 'x', 'size': 16}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Button.html.twig', {'variant': 'ghost', 'size': 'sm', 'type': 'button', 'class': 'shrink-0', 'attrs': og_attrs(['aria-label', v_close]), 'children': c_2}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'justify': 'between', 'children': c_3}, with_context = false) }}
    {%- set c_5 -%}
      {{ include('blocks/media-frame.html.twig', {'p': {'alt': (og_t(v_imageAlt) ? v_imageAlt : v_title), 'src': v_image}}, with_context = false) }}
      {%- set c_4 -%}
        {{ include('icons/LucideIcon.html.twig', {'name': 'play', 'size': 24}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'default', 'type': 'button', 'class': 'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded', 'attrs': og_attrs(['aria-label', v_play]), 'children': c_4}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Box.html.twig', {'class': 'relative', 'attrs': og_attrs(['data-slot', 'player']), 'children': c_5}, with_context = false) }}
    {%- if og_t(og_and([og_eq(v_outline, 'chapters'), og_gt(og_len(v_chapters), 0)])) %}
      {%- set c_11 -%}
        {%- set c_6 -%}
          {{ og_text(v_chaptersTitle) }}
        {%- endset -%}
        {{ include('compose/Title.html.twig', {'as': 3, 'size': 'base', 'weight': 'bold', 'children': c_6}, with_context = false) }}
        {%- set c_10 -%}
          {%- for v_c in og_l(v_chapters) %}
            {%- set c_9 -%}
              {%- set c_7 -%}
                {{ og_text(og_get(v_c, ['title'])) }}
              {%- endset -%}
              {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_7}, with_context = false) }}
              {%- set c_8 -%}
                {{ og_text(og_get(v_c, ['text'])) }}
              {%- endset -%}
              {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_8}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/ListItem.html.twig', {'class': 'flex items-baseline gap-4', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_9}, with_context = false) }}
          {%- endfor %}
        {%- endset -%}
        {{ include('compose/List.html.twig', {'class': 'm-0 flex list-none flex-col gap-2 p-0', 'children': c_10}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Stack.html.twig', {'gap': '2', 'attrs': og_attrs(['data-slot', 'chapters']), 'children': c_11}, with_context = false) }}
    {%- endif %}
  {%- endset -%}
  {{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'class': og_s(og_cnv(['mx-auto w-full', (og_t(og_eq(v_size, 'wide')) ? 'max-w-4xl' : 'max-w-2xl'), 'rounded bg-card inset-ring inset-ring-border p-4 shadow-lg'])), 'attrs': og_attrs(['role', 'dialog', 'aria-label', v_title, 'data-slot', 'video-modal']), 'children': c_12}, with_context = false) }}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_13)}, 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-modal
blocks/video-modal.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-modal.json
    A dialog with a walkthrough video: a title and a close button, the player area with a play button and, optionally, a list of chapters. Opening the dialog and playing the video are port contracts. Axes: size (default, wide), outline (none, chapters: a list under the player), tone.
    Props (p): id, title, text, close, play, chaptersTitle, chapters, size, outline, tone, image, imageAlt, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_text = ($p['text'] ?? null)}
{var $v_close = ($p['close'] ?? null)}
{var $v_play = ($p['play'] ?? null)}
{var $v_chaptersTitle = ($p['chaptersTitle'] ?? null)}
{var $v_chapters = ($p['chapters'] ?? null)}
{var $v_size = ($p['size'] ?? 'default')}
{var $v_outline = ($p['outline'] ?? 'none')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_image = ($p['image'] ?? null)}
{var $v_imageAlt = ($p['imageAlt'] ?? null)}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_13}
  {capture $c_12}
    {capture $c_3}
      {capture $c_1}
        {=og_text($v_text)}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_1])|noescape}
      {capture $c_2}
        {=og_include('icons/LucideIcon.latte', ['name' => 'x', 'size' => 16])|noescape}
      {/capture}
      {=og_include('compose/Button.latte', ['variant' => 'ghost', 'size' => 'sm', 'type' => 'button', 'class' => 'shrink-0', 'attrs' => og_attrs(['aria-label', $v_close]), 'children' => (string) $c_2])|noescape}
    {/capture}
    {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'justify' => 'between', 'children' => (string) $c_3])|noescape}
    {capture $c_5}
      {=og_include('blocks/media-frame.latte', ['p' => ['alt' => (og_t($v_imageAlt) ? $v_imageAlt : $v_title), 'src' => $v_image]])|noescape}
      {capture $c_4}
        {=og_include('icons/LucideIcon.latte', ['name' => 'play', 'size' => 24])|noescape}
      {/capture}
      {=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'default', 'type' => 'button', 'class' => 'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded', 'attrs' => og_attrs(['aria-label', $v_play]), 'children' => (string) $c_4])|noescape}
    {/capture}
    {=og_include('compose/Box.latte', ['class' => 'relative', 'attrs' => og_attrs(['data-slot', 'player']), 'children' => (string) $c_5])|noescape}
    {if og_t(og_and([og_eq($v_outline, 'chapters'), og_gt(og_len($v_chapters), 0)]))}
      {capture $c_11}
        {capture $c_6}
          {=og_text($v_chaptersTitle)}
        {/capture}
        {=og_include('compose/Title.latte', ['as' => 3, 'size' => 'base', 'weight' => 'bold', 'children' => (string) $c_6])|noescape}
        {capture $c_10}
          {foreach og_l($v_chapters) as $v_c}
            {capture $c_9}
              {capture $c_7}
                {=og_text(og_get($v_c, ['title']))}
              {/capture}
              {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_7])|noescape}
              {capture $c_8}
                {=og_text(og_get($v_c, ['text']))}
              {/capture}
              {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_8])|noescape}
            {/capture}
            {=og_include('compose/ListItem.latte', ['class' => 'flex items-baseline gap-4', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_9])|noescape}
          {/foreach}
        {/capture}
        {=og_include('compose/List.latte', ['class' => 'm-0 flex list-none flex-col gap-2 p-0', 'children' => (string) $c_10])|noescape}
      {/capture}
      {=og_include('compose/Stack.latte', ['gap' => '2', 'attrs' => og_attrs(['data-slot', 'chapters']), 'children' => (string) $c_11])|noescape}
    {/if}
  {/capture}
  {=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'class' => og_s(og_cnv(['mx-auto w-full', (og_t(og_eq($v_size, 'wide')) ? 'max-w-4xl' : 'max-w-2xl'), 'rounded bg-card inset-ring inset-ring-border p-4 shadow-lg'])), 'attrs' => og_attrs(['role', 'dialog', 'aria-label', $v_title, 'data-slot', 'video-modal']), 'children' => (string) $c_12])|noescape}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_13)])|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-modal
blocks/video-modal.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-modal.json
    A dialog with a walkthrough video: a title and a close button, the player area with a play button and, optionally, a list of chapters. Opening the dialog and playing the video are port contracts. Axes: size (default, wide), outline (none, chapters: a list under the player), tone.
    Props (p): id, title, text, close, play, chaptersTitle, chapters, size, outline, tone, image, imageAlt, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_text = og_def(p['text'], none) -%}
{%- set v_close = og_def(p['close'], none) -%}
{%- set v_play = og_def(p['play'], none) -%}
{%- set v_chaptersTitle = og_def(p['chaptersTitle'], none) -%}
{%- set v_chapters = og_def(p['chapters'], none) -%}
{%- set v_size = og_def(p['size'], 'default') -%}
{%- set v_outline = og_def(p['outline'], 'none') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_image = og_def(p['image'], none) -%}
{%- set v_imageAlt = og_def(p['imageAlt'], none) -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_13 -%}
  {%- set c_12 -%}
    {%- set c_3 -%}
      {%- set c_1 -%}
        {{ og_text(v_text) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_1}) }}
      {%- set c_2 -%}
        {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'x', 'Size': 16}}) }}
      {%- endset -%}
      {{ og_include('compose/button.html.j2', {'p': {'Variant': 'ghost', 'Size': 'sm', 'Type': 'button', 'Class': 'shrink-0', 'Attrs': og_attrs(['aria-label', v_close])}, 'children': c_2}) }}
    {%- endset -%}
    {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Justify': 'between'}, 'children': c_3}) }}
    {%- set c_5 -%}
      {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': (v_imageAlt if og_t(v_imageAlt) else v_title), 'src': v_image}}) }}
      {%- set c_4 -%}
        {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'play', 'Size': 24}}) }}
      {%- endset -%}
      {{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'default', 'Type': 'button', 'Class': 'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded', 'Attrs': og_attrs(['aria-label', v_play])}, 'children': c_4}) }}
    {%- endset -%}
    {{ og_include('compose/box.html.j2', {'p': {'Class': 'relative', 'Attrs': og_attrs(['data-slot', 'player'])}, 'children': c_5}) }}
    {%- if og_t(og_and([og_eq(v_outline, 'chapters'), og_gt(og_len(v_chapters), 0)])) %}
      {%- set c_11 -%}
        {%- set c_6 -%}
          {{ og_text(v_chaptersTitle) }}
        {%- endset -%}
        {{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'base', 'Weight': 'bold'}, 'children': c_6}) }}
        {%- set c_10 -%}
          {%- for v_c in og_l(v_chapters) %}
            {%- set c_9 -%}
              {%- set c_7 -%}
                {{ og_text(og_get(v_c, ['title'])) }}
              {%- endset -%}
              {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_7}) }}
              {%- set c_8 -%}
                {{ og_text(og_get(v_c, ['text'])) }}
              {%- endset -%}
              {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_8}) }}
            {%- endset -%}
            {{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex items-baseline gap-4', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_9}) }}
          {%- endfor %}
        {%- endset -%}
        {{ og_include('compose/list.html.j2', {'p': {'Class': 'm-0 flex list-none flex-col gap-2 p-0'}, 'children': c_10}) }}
      {%- endset -%}
      {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Attrs': og_attrs(['data-slot', 'chapters'])}, 'children': c_11}) }}
    {%- endif %}
  {%- endset -%}
  {{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch', 'Class': og_s(og_cnv(['mx-auto w-full', ('max-w-4xl' if og_t(og_eq(v_size, 'wide')) else 'max-w-2xl'), 'rounded bg-card inset-ring inset-ring-border p-4 shadow-lg'])), 'Attrs': og_attrs(['role', 'dialog', 'aria-label', v_title, 'data-slot', 'video-modal'])}, 'children': c_12}) }}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_13)}) }}

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.

A dialog with a walkthrough video: a title and a close button, the player area with a play button and, optionally, a list of chapters. Opening the dialog and playing the video are port contracts. Axes: size (default, wide), outline (none, chapters: a list under the player), tone.

Props of VideoModal
PropTypeDefault Description
id (required)string-
title (required)string-
text (required)string-
close (required)string-accessible name of the close button
play (required)string-accessible name of the play button
chaptersTitle (required)string-
chapters (required)Chapter[]-
size "default" | "wide""default"
outline "none" | "chapters""none"
tone "default" | "muted""default"
image string-address of the picture (an https URL or a path); none: the placeholder
imageAlt string-alt text of the picture; none: the title
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