Skip to content
ui8kit

block / commerce

Lightbox Gallery

A photo gallery with a dialog for the selected picture. Additive to Photo gallery.

Install

npx ui8kit add lightbox-gallery

Pulls in: box, button, compose, empty-state, figure-block, group, kit-box, kit-button, kit-text, lightbox-stage, lucide-icon, media-frame, photo-gallery, section-frame, stack, text, utils

Preview

The dining room

A look inside the house.

Harbor at dawn
Studio corner
Morning market
Ridge trail
Corner cafe
Dunes at noon
Old library
Iron bridge
Orchard rows

Harbor at dawn

Travel

1 of 9

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 lightbox-gallery
blocks/lightbox-gallery.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. -->
<!--
  Photos in a grid, a masonry of mixed heights, or a featured picture over thumbnails, with a dialog that shows
  the selected photo. Static markup: the dialog open state is a prop. Axes: layout (grid, masonry, featured),
  captions (show, hide), lightbox (open, closed).
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { LightboxLabels } from "./lightbox-gallery.types";
  import type { Photo } from "./photo-gallery.types";

  export type LightboxGalleryProps = {
    id: string;
    title: string;
    lead?: string;
    photos: Photo[];
    empty?: string;
    labels: LightboxLabels;
    layout?: "grid" | "masonry" | "featured";
    captions?: "show" | "hide";
    lightbox?: "open" | "closed";
    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 LucideIcon from "../icons/LucideIcon.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import EmptyState from "../components/empty-state.svelte";
  import FigureBlock from "../components/figure-block.svelte";
  import LightboxStage from "../components/lightbox-stage.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { cn, tpl } from "../utils";

  let {
    id,
    title,
    lead = "",
    photos,
    empty = "",
    labels,
    layout = "grid",
    captions = "show",
    lightbox = "closed",
    landmarkLabel,
  }: LightboxGalleryProps = $props();
</script>

<SectionFrame id={id} title={title} lead={lead} landmarkLabel={landmarkLabel}>
  {#if ((photos?.length ?? 0) === 0)}
    <EmptyState icon="image" title={empty} />
  {:else}
    {#if ((layout as string) === "featured")}
      <Stack gap="4" align="stretch" data-slot="featured">
        <MediaFrame alt={photos[0]?.title ?? ""} src={photos[0]?.image ?? ""} />
        <Group gap="4" align="center" justify="between">
          <Stack gap="0">
            <Text size="base" weight="semibold">
              {photos[0]?.title ?? ""}
            </Text>
            <Text size="xs" class="text-muted-foreground">
              {tpl(labels.counter, 1, (photos?.length ?? 0))}
            </Text>
          </Stack>
          <Group gap="2">
            <Button variant="outline" size="sm" layout="icon" type="button" aria-label={labels.previous}>
              <LucideIcon name="chevron-left" size={16} />
            </Button>
            <Button variant="outline" size="sm" layout="icon" type="button" aria-label={labels.next}>
              <LucideIcon name="chevron-right" size={16} />
            </Button>
          </Group>
        </Group>
        <Box class="grid grid-cols-3 gap-2 sm:grid-cols-9" data-slot="thumbs">
          {#each photos as p, i (p.id)}
            <MediaFrame alt={p.title} src={p.image} ratio="1/1" class={((i === 0) ? "ring-2 ring-foreground" : "")} />
          {/each}
        </Box>
      </Stack>
    {:else}
      <Box
        class={
          (layout as string) === "masonry" ? "columns-1 gap-4 sm:columns-2 lg:columns-3"
          : "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"
        }
        data-slot="items"
      >
        {#each photos as p, i (p.id)}
          <FigureBlock
            class={cn(
              "relative flex flex-col gap-2",
              (((layout as string) === "masonry") ? "mb-4 break-inside-avoid" : "")
            )}
            testid="item"
          >
            <MediaFrame
              alt={p.title}
              src={p.image}
              ratio={
                (layout as string) === "masonry" ? ((p.size === "tall") ? "3/4" : ((p.size === "wide") ? "16/9" : ((p.size === "large") ? "4/3" : "1/1")))
                : "4/3"
              }
            />
            <Button
              variant="ghost"
              size="sm"
              layout="icon"
              type="button"
              class="absolute right-2 top-2 bg-background"
              aria-label={labels.open}
            >
              <LucideIcon name="arrow-up-right" size={16} />
            </Button>
            {#if (((captions as string) === "show") && (((layout as string) === "grid") || ((layout as string) === "masonry")))}
              <Box class="text-sm text-muted-foreground" data-slot="caption">
                {p.title}
              </Box>
            {/if}
          </FigureBlock>
        {/each}
      </Box>
    {/if}
    <LightboxStage photos={photos} labels={labels} captions={captions} lightbox={lightbox} />
  {/if}
</SectionFrame>
blocks/lightbox-gallery.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 LightboxLabels = {
  close: string;
  previous: string;
  next: string;
  open: string;
  counter: 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 lightbox-gallery
blocks/lightbox-gallery.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.
/**
 * Photos in a grid, a masonry of mixed heights, or a featured picture over thumbnails, with a dialog that shows
 * the selected photo. Static markup: the dialog open state is a prop. Axes: layout (grid, masonry, featured),
 * captions (show, hide), lightbox (open, closed).
 */
import { type ReactNode } from "react";
import { Box, Button, Group, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { FigureBlock } from "../components/figure-block";
import { LightboxStage } from "../components/lightbox-stage";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { cn, tpl } from "../utils";
import type { LightboxLabels } from "./lightbox-gallery.types";
import type { Photo } from "./photo-gallery.types";

export type LightboxGalleryProps = {
  id: string;
  title: string;
  lead?: string;
  photos: Photo[];
  empty?: string;
  labels: LightboxLabels;
  layout?: "grid" | "masonry" | "featured";
  captions?: "show" | "hide";
  lightbox?: "open" | "closed";
  landmarkLabel?: string;
};

export function LightboxGallery({
  id,
  title,
  lead = "",
  photos,
  empty = "",
  labels,
  layout = "grid",
  captions = "show",
  lightbox = "closed",
  landmarkLabel,
}: LightboxGalleryProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} landmarkLabel={landmarkLabel}>
      {((photos?.length ?? 0) === 0) ? (
        <EmptyState icon="image" title={empty} />
      ) : (
        <>
          {((layout as string) === "featured") ? (
            <Stack gap="4" align="stretch" data-slot="featured">
              <MediaFrame alt={photos[0]?.title ?? ""} src={photos[0]?.image ?? ""} />
              <Group gap="4" align="center" justify="between">
                <Stack gap="0">
                  <Text size="base" weight="semibold">
                    {photos[0]?.title ?? ""}
                  </Text>
                  <Text size="xs" className="text-muted-foreground">
                    {tpl(labels.counter, 1, (photos?.length ?? 0))}
                  </Text>
                </Stack>
                <Group gap="2">
                  <Button variant="outline" size="sm" layout="icon" type="button" aria-label={labels.previous}>
                    <LucideIcon name="chevron-left" size={16} />
                  </Button>
                  <Button variant="outline" size="sm" layout="icon" type="button" aria-label={labels.next}>
                    <LucideIcon name="chevron-right" size={16} />
                  </Button>
                </Group>
              </Group>
              <Box className="grid grid-cols-3 gap-2 sm:grid-cols-9" data-slot="thumbs">
                {(photos ?? []).map((p, i) => (
                  <MediaFrame key={p.id} alt={p.title} src={p.image} ratio="1/1" className={((i === 0) ? "ring-2 ring-foreground" : "")} />
                ))}
              </Box>
            </Stack>
          ) : (
            <Box
              className={
                (layout as string) === "masonry" ? "columns-1 gap-4 sm:columns-2 lg:columns-3"
                : "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"
              }
              data-slot="items"
            >
              {(photos ?? []).map((p, i) => (
                <FigureBlock key={p.id}
                  className={cn(
                    "relative flex flex-col gap-2",
                    (((layout as string) === "masonry") ? "mb-4 break-inside-avoid" : "")
                  )}
                  testid="item"
                >
                  <MediaFrame
                    alt={p.title}
                    src={p.image}
                    ratio={
                      (layout as string) === "masonry" ? ((p.size === "tall") ? "3/4" : ((p.size === "wide") ? "16/9" : ((p.size === "large") ? "4/3" : "1/1")))
                      : "4/3"
                    }
                  />
                  <Button
                    variant="ghost"
                    size="sm"
                    layout="icon"
                    type="button"
                    className="absolute right-2 top-2 bg-background"
                    aria-label={labels.open}
                  >
                    <LucideIcon name="arrow-up-right" size={16} />
                  </Button>
                  {(((captions as string) === "show") && (((layout as string) === "grid") || ((layout as string) === "masonry"))) ? (
                    <Box className="text-sm text-muted-foreground" data-slot="caption">
                      {p.title}
                    </Box>
                  ) : null}
                </FigureBlock>
              ))}
            </Box>
          )}
          <LightboxStage photos={photos} labels={labels} captions={captions} lightbox={lightbox} />
        </>
      )}
    </SectionFrame>
  );
}
blocks/lightbox-gallery.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 LightboxLabels = {
  close: string;
  previous: string;
  next: string;
  open: string;
  counter: 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 lightbox-gallery
blocks/lightbox-gallery.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 LightboxLabels = {
  close: string;
  previous: string;
  next: string;
  open: string;
  counter: string;
};
blocks/lightbox-gallery.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. -->
<!--
  Photos in a grid, a masonry of mixed heights, or a featured picture over thumbnails, with a dialog that shows
  the selected photo. Static markup: the dialog open state is a prop. Axes: layout (grid, masonry, featured),
  captions (show, hide), lightbox (open, closed).
-->
<script lang="ts">
import type { LightboxLabels } from "./lightbox-gallery.types";
import type { Photo } from "./photo-gallery.types";

export type LightboxGalleryProps = {
  id: string;
  title: string;
  lead?: string;
  photos: Photo[];
  empty?: string;
  labels: LightboxLabels;
  layout?: "grid" | "masonry" | "featured";
  captions?: "show" | "hide";
  lightbox?: "open" | "closed";
  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 LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import EmptyState from "../components/empty-state.vue";
import FigureBlock from "../components/figure-block.vue";
import LightboxStage from "../components/lightbox-stage.vue";
import MediaFrame from "../components/media-frame.vue";
import SectionFrame from "../components/section-frame.vue";
import { cn, tpl } from "../utils";

const {
  id,
  title,
  lead = "",
  photos,
  empty = "",
  labels,
  layout = "grid",
  captions = "show",
  lightbox = "closed",
  landmarkLabel,
} = defineProps<LightboxGalleryProps>();
</script>

<template>
  <SectionFrame :id="id" :title="title" :lead="lead" :landmarkLabel="landmarkLabel">
    <EmptyState v-if="((photos?.length ?? 0) === 0)" icon="image" :title="empty" />
    <template v-else>
      <Stack v-if="((layout as string) === 'featured')" gap="4" align="stretch" data-slot="featured">
        <MediaFrame :alt="photos[0]?.title ?? ''" :src="photos[0]?.image ?? ''" />
        <Group gap="4" align="center" justify="between">
          <Stack gap="0">
            <Text size="base" weight="semibold">
              {{ photos[0]?.title ?? "" }}
            </Text>
            <Text size="xs" class="text-muted-foreground">
              {{ tpl(labels.counter, 1, (photos?.length ?? 0)) }}
            </Text>
          </Stack>
          <Group gap="2">
            <Button variant="outline" size="sm" layout="icon" type="button" :aria-label="labels.previous">
              <LucideIcon name="chevron-left" :size="16" />
            </Button>
            <Button variant="outline" size="sm" layout="icon" type="button" :aria-label="labels.next">
              <LucideIcon name="chevron-right" :size="16" />
            </Button>
          </Group>
        </Group>
        <Box class="grid grid-cols-3 gap-2 sm:grid-cols-9" data-slot="thumbs">
          <MediaFrame
            v-for="(p, i) in photos"
            :key="p.id"
            :alt="p.title"
            :src="p.image"
            ratio="1/1"
            :class="((i === 0) ? 'ring-2 ring-foreground' : '')"
          />
        </Box>
      </Stack>
      <Box v-else
        :class="
          (layout as string) === 'masonry' ? 'columns-1 gap-4 sm:columns-2 lg:columns-3'
          : 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3'
        "
        data-slot="items"
      >
        <FigureBlock v-for="(p, i) in photos" :key="p.id"
          :class="cn(
            'relative flex flex-col gap-2',
            (((layout as string) === 'masonry') ? 'mb-4 break-inside-avoid' : '')
          )"
          testid="item"
        >
          <MediaFrame
            :alt="p.title"
            :src="p.image"
            :ratio="
              (layout as string) === 'masonry' ? ((p.size === 'tall') ? '3/4' : ((p.size === 'wide') ? '16/9' : ((p.size === 'large') ? '4/3' : '1/1')))
              : '4/3'
            "
          />
          <Button
            variant="ghost"
            size="sm"
            layout="icon"
            type="button"
            class="absolute right-2 top-2 bg-background"
            :aria-label="labels.open"
          >
            <LucideIcon name="arrow-up-right" :size="16" />
          </Button>
          <Box
            v-if="(((captions as string) === 'show') && (((layout as string) === 'grid') || ((layout as string) === 'masonry')))"
            class="text-sm text-muted-foreground"
            data-slot="caption"
          >
            {{ p.title }}
          </Box>
        </FigureBlock>
      </Box>
      <LightboxStage :photos="photos" :labels="labels" :captions="captions" :lightbox="lightbox" />
    </template>
  </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 lightbox-gallery
blocks/lightbox-gallery.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.
/**
 * Photos in a grid, a masonry of mixed heights, or a featured picture over thumbnails, with a dialog that shows
 * the selected photo. Static markup: the dialog open state is a prop. Axes: layout (grid, masonry, featured),
 * captions (show, hide), lightbox (open, closed).
 */
import { For, type JSX } from "solid-js";
import { Box, Button, Group, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { EmptyState } from "../components/empty-state";
import { FigureBlock } from "../components/figure-block";
import { LightboxStage } from "../components/lightbox-stage";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { cn, tpl } from "../utils";
import type { LightboxLabels } from "./lightbox-gallery.types";
import type { Photo } from "./photo-gallery.types";

export type LightboxGalleryProps = {
  id: string;
  title: string;
  lead?: string;
  photos: Photo[];
  empty?: string;
  labels: LightboxLabels;
  layout?: "grid" | "masonry" | "featured";
  captions?: "show" | "hide";
  lightbox?: "open" | "closed";
  landmarkLabel?: string;
};

export function LightboxGallery({
  id,
  title,
  lead = "",
  photos,
  empty = "",
  labels,
  layout = "grid",
  captions = "show",
  lightbox = "closed",
  landmarkLabel,
}: LightboxGalleryProps) {
  return (
    <SectionFrame id={id} title={title} lead={lead} landmarkLabel={landmarkLabel}>
      {((photos?.length ?? 0) === 0) ? (
        <EmptyState icon="image" title={empty} />
      ) : (
        <>
          {((layout as string) === "featured") ? (
            <Stack gap="4" align="stretch" data-slot="featured">
              <MediaFrame alt={photos[0]?.title ?? ""} src={photos[0]?.image ?? ""} />
              <Group gap="4" align="center" justify="between">
                <Stack gap="0">
                  <Text size="base" weight="semibold">
                    {photos[0]?.title ?? ""}
                  </Text>
                  <Text size="xs" class="text-muted-foreground">
                    {tpl(labels.counter, 1, (photos?.length ?? 0))}
                  </Text>
                </Stack>
                <Group gap="2">
                  <Button variant="outline" size="sm" layout="icon" type="button" aria-label={labels.previous}>
                    <LucideIcon name="chevron-left" size={16} />
                  </Button>
                  <Button variant="outline" size="sm" layout="icon" type="button" aria-label={labels.next}>
                    <LucideIcon name="chevron-right" size={16} />
                  </Button>
                </Group>
              </Group>
              <Box class="grid grid-cols-3 gap-2 sm:grid-cols-9" data-slot="thumbs">
                <For each={photos ?? []}>{(p, iOf) => { const i = iOf(); return (
                  <MediaFrame alt={p.title} src={p.image} ratio="1/1" class={((i === 0) ? "ring-2 ring-foreground" : "")} />
                ); }}</For>
              </Box>
            </Stack>
          ) : (
            <Box
              class={
                (layout as string) === "masonry" ? "columns-1 gap-4 sm:columns-2 lg:columns-3"
                : "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"
              }
              data-slot="items"
            >
              <For each={photos ?? []}>{(p, iOf) => { const i = iOf(); return (
                <FigureBlock
                  class={cn(
                    "relative flex flex-col gap-2",
                    (((layout as string) === "masonry") ? "mb-4 break-inside-avoid" : "")
                  )}
                  testid="item"
                >
                  <MediaFrame
                    alt={p.title}
                    src={p.image}
                    ratio={
                      (layout as string) === "masonry" ? ((p.size === "tall") ? "3/4" : ((p.size === "wide") ? "16/9" : ((p.size === "large") ? "4/3" : "1/1")))
                      : "4/3"
                    }
                  />
                  <Button
                    variant="ghost"
                    size="sm"
                    layout="icon"
                    type="button"
                    class="absolute right-2 top-2 bg-background"
                    aria-label={labels.open}
                  >
                    <LucideIcon name="arrow-up-right" size={16} />
                  </Button>
                  {(((captions as string) === "show") && (((layout as string) === "grid") || ((layout as string) === "masonry"))) ? (
                    <Box class="text-sm text-muted-foreground" data-slot="caption">
                      {p.title}
                    </Box>
                  ) : null}
                </FigureBlock>
              ); }}</For>
            </Box>
          )}
          <LightboxStage photos={photos} labels={labels} captions={captions} lightbox={lightbox} />
        </>
      )}
    </SectionFrame>
  );
}
blocks/lightbox-gallery.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 LightboxLabels = {
  close: string;
  previous: string;
  next: string;
  open: string;
  counter: 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 lightbox-gallery
blocks/lightbox-gallery.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/lightbox-gallery.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"
)

// LightboxGalleryProps are the props of LightboxGallery; the values are the JSON shapes of the TypeScript props.
type LightboxGalleryProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Lead any `json:"lead"`
	Photos any `json:"photos"`
	Empty any `json:"empty"`
	Labels any `json:"labels"`
	Layout any `json:"layout"`
	Captions any `json:"captions"`
	Lightbox any `json:"lightbox"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// Photos in a grid, a masonry of mixed heights, or a featured picture over thumbnails, with a dialog that shows the selected photo. Static markup: the dialog open state is a prop. Axes: layout (grid, masonry, featured), captions (show, hide), lightbox (open, closed).
templ LightboxGallery(p LightboxGalleryProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vLead := uiutils.Def(p.Lead, "") }}
	{{ vPhotos := p.Photos }}
	{{ vEmpty := uiutils.Def(p.Empty, "") }}
	{{ vLabels := p.Labels }}
	{{ vLayout := uiutils.Def(p.Layout, "grid") }}
	{{ vCaptions := uiutils.Def(p.Captions, "show") }}
	{{ vLightbox := uiutils.Def(p.Lightbox, "closed") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vLead, LandmarkLabel: vLandmarkLabel}) {
		if uiutils.Eq(uiutils.Len(vPhotos), float64(0)) {
			@EmptyState(EmptyStateProps{Icon: "image", Title: vEmpty})
		} else {
			if uiutils.Eq(vLayout, "featured") {
				@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "featured")}}) {
					@MediaFrame(MediaFrameProps{Alt: uiutils.FirstOf(vPhotos, "title"), Src: uiutils.FirstOf(vPhotos, "image")})
					@compose.Group(compose.GroupProps{Gap: "4", Align: "center", Justify: "between", BoxProps: box.BoxProps{}}) {
						@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{}}) {
							@compose.Text(compose.TextProps{Size: "base", Weight: "semibold", TextProps: text.TextProps{}}) {
								{ uiutils.Text(uiutils.FirstOf(vPhotos, "title")) }
							}
							@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
								{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "counter"), float64(1), uiutils.Len(vPhotos))) }
							}
						}
						@compose.Group(compose.GroupProps{Gap: "2", BoxProps: box.BoxProps{}}) {
							@compose.Button(compose.ButtonProps{Variant: "outline", Size: "sm", Layout: "icon", ButtonProps: button.ButtonProps{Type: "button", AriaLabel: uiutils.S(uiutils.Get(vLabels, "previous"))}}) {
								@icons.LucideIcon(icons.LucideIconProps{Name: "chevron-left", Size: 16})
							}
							@compose.Button(compose.ButtonProps{Variant: "outline", Size: "sm", Layout: "icon", ButtonProps: button.ButtonProps{Type: "button", AriaLabel: uiutils.S(uiutils.Get(vLabels, "next"))}}) {
								@icons.LucideIcon(icons.LucideIconProps{Name: "chevron-right", Size: 16})
							}
						}
					}
					@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "grid grid-cols-3 gap-2 sm:grid-cols-9", Attrs: uiutils.Attrs("data-slot", "thumbs")}}) {
						for vI, vP := range uiutils.L(vPhotos) {
							@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vP, "title"), Src: uiutils.Get(vP, "image"), Ratio: "1/1", Class: uiutils.Cnv(uiutils.Cond(uiutils.T(uiutils.Eq(float64(vI), float64(0))), "ring-2 ring-foreground", ""))})
						}
					}
				}
			} else {
				@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "masonry")), "columns-1 gap-4 sm:columns-2 lg:columns-3", "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3")), Attrs: uiutils.Attrs("data-slot", "items")}}) {
					for _, vP := range uiutils.L(vPhotos) {
						@FigureBlock(FigureBlockProps{Class: uiutils.Cnv(uiutils.Cnv("relative flex flex-col gap-2", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "masonry")), "mb-4 break-inside-avoid", ""))), Testid: "item"}) {
							@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vP, "title"), Src: uiutils.Get(vP, "image"), Ratio: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "masonry")), uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vP, "size"), "tall")), "3/4", uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vP, "size"), "wide")), "16/9", uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vP, "size"), "large")), "4/3", "1/1"))), "4/3")})
							@compose.Button(compose.ButtonProps{Variant: "ghost", Size: "sm", Layout: "icon", ButtonProps: button.ButtonProps{Type: "button", Class: "absolute right-2 top-2 bg-background", AriaLabel: uiutils.S(uiutils.Get(vLabels, "open"))}}) {
								@icons.LucideIcon(icons.LucideIconProps{Name: "arrow-up-right", Size: 16})
							}
							if uiutils.T(uiutils.And(uiutils.Eq(vCaptions, "show"), uiutils.Or(uiutils.Eq(vLayout, "grid"), uiutils.Eq(vLayout, "masonry")))) {
								@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "text-sm text-muted-foreground", Attrs: uiutils.Attrs("data-slot", "caption")}}) {
									{ uiutils.Text(uiutils.Get(vP, "title")) }
								}
							}
						}
					}
				}
			}
			@LightboxStage(LightboxStageProps{Photos: vPhotos, Labels: vLabels, Captions: vCaptions, Lightbox: vLightbox})
		}
	}
}

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 lightbox-gallery
blocks/lightbox-gallery.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/lightbox-gallery.json
    Photos in a grid, a masonry of mixed heights, or a featured picture over thumbnails, with a dialog that shows the selected photo. Static markup: the dialog open state is a prop. Axes: layout (grid, masonry, featured), captions (show, hide), lightbox (open, closed).
    Props (p): id, title, lead, photos, empty, labels, layout, captions, lightbox, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_lead = (p.lead ?? '') -%}
{%- set v_photos = (p.photos ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_layout = (p.layout ?? 'grid') -%}
{%- set v_captions = (p.captions ?? 'show') -%}
{%- set v_lightbox = (p.lightbox ?? 'closed') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_14 -%}
  {%- if og_t(og_eq(og_len(v_photos), 0)) %}
    {{ include('blocks/empty-state.html.twig', {'p': {'icon': 'image', 'title': v_empty}}, with_context = false) }}
  {%- else %}
    {%- if og_t(og_eq(v_layout, 'featured')) %}
      {%- set c_9 -%}
        {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_first_of(v_photos, 'title'), 'src': og_first_of(v_photos, 'image')}}, with_context = false) }}
        {%- set c_7 -%}
          {%- set c_3 -%}
            {%- set c_1 -%}
              {{ og_text(og_first_of(v_photos, 'title')) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'base', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
            {%- set c_2 -%}
              {{ og_text(og_tpl(og_get(v_labels, ['counter']), [1, og_len(v_photos)])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Stack.html.twig', {'gap': '0', 'children': c_3}, with_context = false) }}
          {%- set c_6 -%}
            {%- set c_4 -%}
              {{ include('icons/LucideIcon.html.twig', {'name': 'chevron-left', 'size': 16}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Button.html.twig', {'variant': 'outline', 'size': 'sm', 'layout': 'icon', 'type': 'button', 'ariaLabel': og_s(og_get(v_labels, ['previous'])), 'children': c_4}, with_context = false) }}
            {%- set c_5 -%}
              {{ include('icons/LucideIcon.html.twig', {'name': 'chevron-right', 'size': 16}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Button.html.twig', {'variant': 'outline', 'size': 'sm', 'layout': 'icon', 'type': 'button', 'ariaLabel': og_s(og_get(v_labels, ['next'])), 'children': c_5}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Group.html.twig', {'gap': '2', 'children': c_6}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'justify': 'between', 'children': c_7}, with_context = false) }}
        {%- set c_8 -%}
          {%- for v_p in og_l(v_photos) %}
            {%- set v_i = loop.index0 -%}
            {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_p, ['title']), 'src': og_get(v_p, ['image']), 'ratio': '1/1', 'className': og_cnv([(og_t(og_eq(v_i, 0)) ? 'ring-2 ring-foreground' : '')])}}, with_context = false) }}
          {%- endfor %}
        {%- endset -%}
        {{ include('compose/Box.html.twig', {'class': 'grid grid-cols-3 gap-2 sm:grid-cols-9', 'attrs': og_attrs(['data-slot', 'thumbs']), 'children': c_8}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'featured']), 'children': c_9}, with_context = false) }}
    {%- else %}
      {%- set c_13 -%}
        {%- for v_p in og_l(v_photos) %}
          {%- set v_i = loop.index0 -%}
          {%- set c_12 -%}
            {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_p, ['title']), 'src': og_get(v_p, ['image']), 'ratio': (og_t(og_eq(v_layout, 'masonry')) ? (og_t(og_eq(og_get(v_p, ['size']), 'tall')) ? '3/4' : (og_t(og_eq(og_get(v_p, ['size']), 'wide')) ? '16/9' : (og_t(og_eq(og_get(v_p, ['size']), 'large')) ? '4/3' : '1/1'))) : '4/3')}}, with_context = false) }}
            {%- set c_10 -%}
              {{ include('icons/LucideIcon.html.twig', {'name': 'arrow-up-right', 'size': 16}, with_context = false) }}
            {%- endset -%}
            {{ include('compose/Button.html.twig', {'variant': 'ghost', 'size': 'sm', 'layout': 'icon', 'type': 'button', 'class': 'absolute right-2 top-2 bg-background', 'ariaLabel': og_s(og_get(v_labels, ['open'])), 'children': c_10}, with_context = false) }}
            {%- if og_t(og_and([og_eq(v_captions, 'show'), og_or([og_eq(v_layout, 'grid'), og_eq(v_layout, 'masonry')])])) %}
              {%- set c_11 -%}
                {{ og_text(og_get(v_p, ['title'])) }}
              {%- endset -%}
              {{ include('compose/Box.html.twig', {'class': 'text-sm text-muted-foreground', 'attrs': og_attrs(['data-slot', 'caption']), 'children': c_11}, with_context = false) }}
            {%- endif %}
          {%- endset -%}
          {{ include('blocks/figure-block.html.twig', {'p': {'className': og_cnv([og_cnv(['relative flex flex-col gap-2', (og_t(og_eq(v_layout, 'masonry')) ? 'mb-4 break-inside-avoid' : '')])]), 'testid': 'item'}, 'children': og_markup(c_12)}, with_context = false) }}
        {%- endfor %}
      {%- endset -%}
      {{ include('compose/Box.html.twig', {'class': og_s((og_t(og_eq(v_layout, 'masonry')) ? 'columns-1 gap-4 sm:columns-2 lg:columns-3' : 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3')), 'attrs': og_attrs(['data-slot', 'items']), 'children': c_13}, with_context = false) }}
    {%- endif %}
    {{ include('blocks/lightbox-stage.html.twig', {'p': {'photos': v_photos, 'labels': v_labels, 'captions': v_captions, 'lightbox': v_lightbox}}, with_context = false) }}
  {%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_14)}, 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 lightbox-gallery
blocks/lightbox-gallery.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/lightbox-gallery.json
    Photos in a grid, a masonry of mixed heights, or a featured picture over thumbnails, with a dialog that shows the selected photo. Static markup: the dialog open state is a prop. Axes: layout (grid, masonry, featured), captions (show, hide), lightbox (open, closed).
    Props (p): id, title, lead, photos, empty, labels, layout, captions, lightbox, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_lead = ($p['lead'] ?? '')}
{var $v_photos = ($p['photos'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'grid')}
{var $v_captions = ($p['captions'] ?? 'show')}
{var $v_lightbox = ($p['lightbox'] ?? 'closed')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_14}
  {if og_t(og_eq(og_len($v_photos), 0))}
    {=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'image', 'title' => $v_empty]])|noescape}
  {else}
    {if og_t(og_eq($v_layout, 'featured'))}
      {capture $c_9}
        {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_first_of($v_photos, 'title'), 'src' => og_first_of($v_photos, 'image')]])|noescape}
        {capture $c_7}
          {capture $c_3}
            {capture $c_1}
              {=og_text(og_first_of($v_photos, 'title'))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'base', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
            {capture $c_2}
              {=og_text(og_tpl(og_get($v_labels, ['counter']), [1, og_len($v_photos)]))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
          {/capture}
          {=og_include('compose/Stack.latte', ['gap' => '0', 'children' => (string) $c_3])|noescape}
          {capture $c_6}
            {capture $c_4}
              {=og_include('icons/LucideIcon.latte', ['name' => 'chevron-left', 'size' => 16])|noescape}
            {/capture}
            {=og_include('compose/Button.latte', ['variant' => 'outline', 'size' => 'sm', 'layout' => 'icon', 'type' => 'button', 'ariaLabel' => og_s(og_get($v_labels, ['previous'])), 'children' => (string) $c_4])|noescape}
            {capture $c_5}
              {=og_include('icons/LucideIcon.latte', ['name' => 'chevron-right', 'size' => 16])|noescape}
            {/capture}
            {=og_include('compose/Button.latte', ['variant' => 'outline', 'size' => 'sm', 'layout' => 'icon', 'type' => 'button', 'ariaLabel' => og_s(og_get($v_labels, ['next'])), 'children' => (string) $c_5])|noescape}
          {/capture}
          {=og_include('compose/Group.latte', ['gap' => '2', 'children' => (string) $c_6])|noescape}
        {/capture}
        {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'justify' => 'between', 'children' => (string) $c_7])|noescape}
        {capture $c_8}
          {foreach og_l($v_photos) as $v_p}
            {var $v_i = $iterator->counter0}
            {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_p, ['title']), 'src' => og_get($v_p, ['image']), 'ratio' => '1/1', 'className' => og_cnv([(og_t(og_eq($v_i, 0)) ? 'ring-2 ring-foreground' : '')])]])|noescape}
          {/foreach}
        {/capture}
        {=og_include('compose/Box.latte', ['class' => 'grid grid-cols-3 gap-2 sm:grid-cols-9', 'attrs' => og_attrs(['data-slot', 'thumbs']), 'children' => (string) $c_8])|noescape}
      {/capture}
      {=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'featured']), 'children' => (string) $c_9])|noescape}
    {else}
      {capture $c_13}
        {foreach og_l($v_photos) as $v_p}
          {var $v_i = $iterator->counter0}
          {capture $c_12}
            {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_p, ['title']), 'src' => og_get($v_p, ['image']), 'ratio' => (og_t(og_eq($v_layout, 'masonry')) ? (og_t(og_eq(og_get($v_p, ['size']), 'tall')) ? '3/4' : (og_t(og_eq(og_get($v_p, ['size']), 'wide')) ? '16/9' : (og_t(og_eq(og_get($v_p, ['size']), 'large')) ? '4/3' : '1/1'))) : '4/3')]])|noescape}
            {capture $c_10}
              {=og_include('icons/LucideIcon.latte', ['name' => 'arrow-up-right', 'size' => 16])|noescape}
            {/capture}
            {=og_include('compose/Button.latte', ['variant' => 'ghost', 'size' => 'sm', 'layout' => 'icon', 'type' => 'button', 'class' => 'absolute right-2 top-2 bg-background', 'ariaLabel' => og_s(og_get($v_labels, ['open'])), 'children' => (string) $c_10])|noescape}
            {if og_t(og_and([og_eq($v_captions, 'show'), og_or([og_eq($v_layout, 'grid'), og_eq($v_layout, 'masonry')])]))}
              {capture $c_11}
                {=og_text(og_get($v_p, ['title']))}
              {/capture}
              {=og_include('compose/Box.latte', ['class' => 'text-sm text-muted-foreground', 'attrs' => og_attrs(['data-slot', 'caption']), 'children' => (string) $c_11])|noescape}
            {/if}
          {/capture}
          {=og_include('blocks/figure-block.latte', ['p' => ['className' => og_cnv([og_cnv(['relative flex flex-col gap-2', (og_t(og_eq($v_layout, 'masonry')) ? 'mb-4 break-inside-avoid' : '')])]), 'testid' => 'item'], 'children' => og_markup($c_12)])|noescape}
        {/foreach}
      {/capture}
      {=og_include('compose/Box.latte', ['class' => og_s((og_t(og_eq($v_layout, 'masonry')) ? 'columns-1 gap-4 sm:columns-2 lg:columns-3' : 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3')), 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_13])|noescape}
    {/if}
    {=og_include('blocks/lightbox-stage.latte', ['p' => ['photos' => $v_photos, 'labels' => $v_labels, 'captions' => $v_captions, 'lightbox' => $v_lightbox]])|noescape}
  {/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_lead, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_14)])|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 lightbox-gallery
blocks/lightbox-gallery.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/lightbox-gallery.json
    Photos in a grid, a masonry of mixed heights, or a featured picture over thumbnails, with a dialog that shows the selected photo. Static markup: the dialog open state is a prop. Axes: layout (grid, masonry, featured), captions (show, hide), lightbox (open, closed).
    Props (p): id, title, lead, photos, empty, labels, layout, captions, lightbox, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_lead = og_def(p['lead'], '') -%}
{%- set v_photos = og_def(p['photos'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'grid') -%}
{%- set v_captions = og_def(p['captions'], 'show') -%}
{%- set v_lightbox = og_def(p['lightbox'], 'closed') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_14 -%}
  {%- if og_t(og_eq(og_len(v_photos), 0)) %}
    {{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'image', 'title': v_empty}}) }}
  {%- else %}
    {%- if og_t(og_eq(v_layout, 'featured')) %}
      {%- set c_9 -%}
        {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_first_of(v_photos, 'title'), 'src': og_first_of(v_photos, 'image')}}) }}
        {%- set c_7 -%}
          {%- set c_3 -%}
            {%- set c_1 -%}
              {{ og_text(og_first_of(v_photos, 'title')) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'base', 'Weight': 'semibold'}, 'children': c_1}) }}
            {%- set c_2 -%}
              {{ og_text(og_tpl(og_get(v_labels, ['counter']), [1, og_len(v_photos)])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
          {%- endset -%}
          {{ og_include('compose/stack.html.j2', {'p': {'Gap': '0'}, 'children': c_3}) }}
          {%- set c_6 -%}
            {%- set c_4 -%}
              {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'chevron-left', 'Size': 16}}) }}
            {%- endset -%}
            {{ og_include('compose/button.html.j2', {'p': {'Variant': 'outline', 'Size': 'sm', 'Layout': 'icon', 'Type': 'button', 'AriaLabel': og_s(og_get(v_labels, ['previous']))}, 'children': c_4}) }}
            {%- set c_5 -%}
              {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'chevron-right', 'Size': 16}}) }}
            {%- endset -%}
            {{ og_include('compose/button.html.j2', {'p': {'Variant': 'outline', 'Size': 'sm', 'Layout': 'icon', 'Type': 'button', 'AriaLabel': og_s(og_get(v_labels, ['next']))}, 'children': c_5}) }}
          {%- endset -%}
          {{ og_include('compose/group.html.j2', {'p': {'Gap': '2'}, 'children': c_6}) }}
        {%- endset -%}
        {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Justify': 'between'}, 'children': c_7}) }}
        {%- set c_8 -%}
          {%- for v_p in og_l(v_photos) %}
            {%- set v_i = loop.index0 -%}
            {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_p, ['title']), 'src': og_get(v_p, ['image']), 'ratio': '1/1', 'className': og_cnv([('ring-2 ring-foreground' if og_t(og_eq(v_i, 0)) else '')])}}) }}
          {%- endfor %}
        {%- endset -%}
        {{ og_include('compose/box.html.j2', {'p': {'Class': 'grid grid-cols-3 gap-2 sm:grid-cols-9', 'Attrs': og_attrs(['data-slot', 'thumbs'])}, 'children': c_8}) }}
      {%- endset -%}
      {{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'featured'])}, 'children': c_9}) }}
    {%- else %}
      {%- set c_13 -%}
        {%- for v_p in og_l(v_photos) %}
          {%- set v_i = loop.index0 -%}
          {%- set c_12 -%}
            {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_p, ['title']), 'src': og_get(v_p, ['image']), 'ratio': (('3/4' if og_t(og_eq(og_get(v_p, ['size']), 'tall')) else ('16/9' if og_t(og_eq(og_get(v_p, ['size']), 'wide')) else ('4/3' if og_t(og_eq(og_get(v_p, ['size']), 'large')) else '1/1'))) if og_t(og_eq(v_layout, 'masonry')) else '4/3')}}) }}
            {%- set c_10 -%}
              {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'arrow-up-right', 'Size': 16}}) }}
            {%- endset -%}
            {{ og_include('compose/button.html.j2', {'p': {'Variant': 'ghost', 'Size': 'sm', 'Layout': 'icon', 'Type': 'button', 'Class': 'absolute right-2 top-2 bg-background', 'AriaLabel': og_s(og_get(v_labels, ['open']))}, 'children': c_10}) }}
            {%- if og_t(og_and([og_eq(v_captions, 'show'), og_or([og_eq(v_layout, 'grid'), og_eq(v_layout, 'masonry')])])) %}
              {%- set c_11 -%}
                {{ og_text(og_get(v_p, ['title'])) }}
              {%- endset -%}
              {{ og_include('compose/box.html.j2', {'p': {'Class': 'text-sm text-muted-foreground', 'Attrs': og_attrs(['data-slot', 'caption'])}, 'children': c_11}) }}
            {%- endif %}
          {%- endset -%}
          {{ og_include('blocks/figure-block.html.j2', {'p': {'className': og_cnv([og_cnv(['relative flex flex-col gap-2', ('mb-4 break-inside-avoid' if og_t(og_eq(v_layout, 'masonry')) else '')])]), 'testid': 'item'}, 'children': og_markup(c_12)}) }}
        {%- endfor %}
      {%- endset -%}
      {{ og_include('compose/box.html.j2', {'p': {'Class': og_s(('columns-1 gap-4 sm:columns-2 lg:columns-3' if og_t(og_eq(v_layout, 'masonry')) else 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3')), 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_13}) }}
    {%- endif %}
    {{ og_include('blocks/lightbox-stage.html.j2', {'p': {'photos': v_photos, 'labels': v_labels, 'captions': v_captions, 'lightbox': v_lightbox}}) }}
  {%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_14)}) }}

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.

Photos in a grid, a masonry of mixed heights, or a featured picture over thumbnails, with a dialog that shows the selected photo. Static markup: the dialog open state is a prop. Axes: layout (grid, masonry, featured), captions (show, hide), lightbox (open, closed).

Props of LightboxGallery
PropTypeDefault Description
id (required)string-
title (required)string-
lead string""
photos (required)Photo[]-
empty string""the text of the empty state (no records), from the dictionary
labels (required)LightboxLabels-
layout "grid" | "masonry" | "featured""grid"
captions "show" | "hide""show"
lightbox "open" | "closed""closed"
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

Used in