Skip to content
ui8kit

block / commerce

Review List

Customer reviews with ratings.

Install

npx ui8kit add review-list

Pulls in: article-block, compose, empty-state, grid, group, kit-box, kit-text, media-frame, rating, section-frame, stack, text, title, utils

Preview

What buyers say

Great light for late work

Bright enough to read, soft enough to relax. The base stays put.

Mar 12, 2026

Solid and simple

Build quality is better than the price suggests.

Mar 03, 2026

Does the job

Easy setup. I would like one more color.

Feb 19, 2026

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 review-list
blocks/review-list.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. -->
<!--
  Customer reviews as cards or plain entries: rating, title, text, author and date. Axes: layout (list, grid),
  columns, item (card, plain), avatar (none, image), tone, density.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Review, ReviewLabels } from "./review-list.types";

  export type ReviewListProps = {
    id: string;
    title: string;
    reviews: Review[];
    labels: ReviewLabels;
    layout?: "list" | "grid";
    item?: "card" | "plain";
    avatar?: "none" | "image";
    tone?: "default" | "muted";
    density?: "default" | "roomy";
    landmarkLabel?: string;
  };
</script>

<script lang="ts">
  import Grid from "../compose/Grid.svelte";
  import Group from "../compose/Group.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import Title from "../compose/Title.svelte";
  import ArticleBlock from "../components/article-block.svelte";
  import EmptyState from "../components/empty-state.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import Rating from "../components/rating.svelte";
  import SectionFrame from "../components/section-frame.svelte";
  import { cn, tpl } from "../utils";

  let {
    id,
    title,
    reviews,
    labels,
    layout = "list",
    item = "card",
    avatar = "none",
    tone = "default",
    density = "default",
    landmarkLabel,
  }: ReviewListProps = $props();
</script>

<SectionFrame
  id={id}
  title={title}
  tone={tone}
  density={density}
  measure={(((layout as string) === "list") ? "2xl" : "default")}
  landmarkLabel={landmarkLabel}
>
  {#if ((reviews?.length ?? 0) === 0)}
    <EmptyState icon="message-square-quote" title={labels.empty} />
  {/if}
  <Grid cols={(((layout as string) === "grid") ? "1-3" : "1")} class="gap-4" data-slot="items">
    {#each reviews as r (r.id)}
      <ArticleBlock
        class={cn(
          "flex h-full flex-col gap-4",
          (
            (item as string) === "card" ? "rounded bg-card p-6 inset-ring inset-ring-border"
            : "border-b border-border pb-4"
          )
        )}
        testid="item"
      >
        <Rating value={r.rating} label={tpl(labels.ratingLabel, r.rating)} />
        <Title as={3} size="base" weight="bold">
          {r.title}
        </Title>
        <Text size="sm" class="text-muted-foreground">
          {r.text}
        </Text>
        <Group gap="4" align="center" class="mt-auto">
          {#if ((avatar as string) === "image")}
            <MediaFrame alt={r.author} ratio="1/1" class="size-10 shrink-0 rounded-full" />
          {/if}
          <Stack gap="0">
            <Text size="sm" weight="semibold">
              {r.author}
            </Text>
            <Text size="xs" class="text-muted-foreground">
              {r.date}
            </Text>
          </Stack>
        </Group>
      </ArticleBlock>
    {/each}
  </Grid>
</SectionFrame>
blocks/review-list.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 Review = {
  id: string;
  title: string;
  author: string;
  rating: number;
  text: string;
  date: string;
};

export type ReviewLabels = {
  ratingLabel: string;
  empty: 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 review-list
blocks/review-list.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.
/**
 * Customer reviews as cards or plain entries: rating, title, text, author and date. Axes: layout (list, grid),
 * columns, item (card, plain), avatar (none, image), tone, density.
 */
import { type ReactNode } from "react";
import { Grid, Group, Stack, Text, Title } from "../compose";
import { ArticleBlock } from "../components/article-block";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { Rating } from "../components/rating";
import { SectionFrame } from "../components/section-frame";
import { cn, tpl } from "../utils";
import type { Review, ReviewLabels } from "./review-list.types";

export type ReviewListProps = {
  id: string;
  title: string;
  reviews: Review[];
  labels: ReviewLabels;
  layout?: "list" | "grid";
  item?: "card" | "plain";
  avatar?: "none" | "image";
  tone?: "default" | "muted";
  density?: "default" | "roomy";
  landmarkLabel?: string;
};

export function ReviewList({
  id,
  title,
  reviews,
  labels,
  layout = "list",
  item = "card",
  avatar = "none",
  tone = "default",
  density = "default",
  landmarkLabel,
}: ReviewListProps) {
  return (
    <SectionFrame
      id={id}
      title={title}
      tone={tone}
      density={density}
      measure={(((layout as string) === "list") ? "2xl" : "default")}
      landmarkLabel={landmarkLabel}
    >
      {((reviews?.length ?? 0) === 0) ? (
        <EmptyState icon="message-square-quote" title={labels.empty} />
      ) : null}
      <Grid cols={(((layout as string) === "grid") ? "1-3" : "1")} className="gap-4" data-slot="items">
        {(reviews ?? []).map((r) => (
          <ArticleBlock key={r.id}
            className={cn(
              "flex h-full flex-col gap-4",
              (
                (item as string) === "card" ? "rounded bg-card p-6 inset-ring inset-ring-border"
                : "border-b border-border pb-4"
              )
            )}
            testid="item"
          >
            <Rating value={r.rating} label={tpl(labels.ratingLabel, r.rating)} />
            <Title as={3} size="base" weight="bold">
              {r.title}
            </Title>
            <Text size="sm" className="text-muted-foreground">
              {r.text}
            </Text>
            <Group gap="4" align="center" className="mt-auto">
              {((avatar as string) === "image") ? (
                <MediaFrame alt={r.author} ratio="1/1" className="size-10 shrink-0 rounded-full" />
              ) : null}
              <Stack gap="0">
                <Text size="sm" weight="semibold">
                  {r.author}
                </Text>
                <Text size="xs" className="text-muted-foreground">
                  {r.date}
                </Text>
              </Stack>
            </Group>
          </ArticleBlock>
        ))}
      </Grid>
    </SectionFrame>
  );
}
blocks/review-list.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 Review = {
  id: string;
  title: string;
  author: string;
  rating: number;
  text: string;
  date: string;
};

export type ReviewLabels = {
  ratingLabel: string;
  empty: 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 review-list
blocks/review-list.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 Review = {
  id: string;
  title: string;
  author: string;
  rating: number;
  text: string;
  date: string;
};

export type ReviewLabels = {
  ratingLabel: string;
  empty: string;
};
blocks/review-list.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. -->
<!--
  Customer reviews as cards or plain entries: rating, title, text, author and date. Axes: layout (list, grid),
  columns, item (card, plain), avatar (none, image), tone, density.
-->
<script lang="ts">
import type { Review, ReviewLabels } from "./review-list.types";

export type ReviewListProps = {
  id: string;
  title: string;
  reviews: Review[];
  labels: ReviewLabels;
  layout?: "list" | "grid";
  item?: "card" | "plain";
  avatar?: "none" | "image";
  tone?: "default" | "muted";
  density?: "default" | "roomy";
  landmarkLabel?: string;
};
</script>

<script setup lang="ts">
import Grid from "../compose/Grid.vue";
import Group from "../compose/Group.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import ArticleBlock from "../components/article-block.vue";
import EmptyState from "../components/empty-state.vue";
import MediaFrame from "../components/media-frame.vue";
import Rating from "../components/rating.vue";
import SectionFrame from "../components/section-frame.vue";
import { cn, tpl } from "../utils";

const {
  id,
  title,
  reviews,
  labels,
  layout = "list",
  item = "card",
  avatar = "none",
  tone = "default",
  density = "default",
  landmarkLabel,
} = defineProps<ReviewListProps>();
</script>

<template>
  <SectionFrame
    :id="id"
    :title="title"
    :tone="tone"
    :density="density"
    :measure="(((layout as string) === 'list') ? '2xl' : 'default')"
    :landmarkLabel="landmarkLabel"
  >
    <EmptyState v-if="((reviews?.length ?? 0) === 0)" icon="message-square-quote" :title="labels.empty" />
    <Grid :cols="(((layout as string) === 'grid') ? '1-3' : '1')" class="gap-4" data-slot="items">
      <ArticleBlock v-for="r in reviews" :key="r.id"
        :class="cn(
          'flex h-full flex-col gap-4',
          (
            (item as string) === 'card' ? 'rounded bg-card p-6 inset-ring inset-ring-border'
            : 'border-b border-border pb-4'
          )
        )"
        testid="item"
      >
        <Rating :value="r.rating" :label="tpl(labels.ratingLabel, r.rating)" />
        <Title :as="3" size="base" weight="bold">
          {{ r.title }}
        </Title>
        <Text size="sm" class="text-muted-foreground">
          {{ r.text }}
        </Text>
        <Group gap="4" align="center" class="mt-auto">
          <MediaFrame
            v-if="((avatar as string) === 'image')"
            :alt="r.author"
            ratio="1/1"
            class="size-10 shrink-0 rounded-full"
          />
          <Stack gap="0">
            <Text size="sm" weight="semibold">
              {{ r.author }}
            </Text>
            <Text size="xs" class="text-muted-foreground">
              {{ r.date }}
            </Text>
          </Stack>
        </Group>
      </ArticleBlock>
    </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 review-list
blocks/review-list.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.
/**
 * Customer reviews as cards or plain entries: rating, title, text, author and date. Axes: layout (list, grid),
 * columns, item (card, plain), avatar (none, image), tone, density.
 */
import { For, type JSX } from "solid-js";
import { Grid, Group, Stack, Text, Title } from "../compose";
import { ArticleBlock } from "../components/article-block";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { Rating } from "../components/rating";
import { SectionFrame } from "../components/section-frame";
import { cn, tpl } from "../utils";
import type { Review, ReviewLabels } from "./review-list.types";

export type ReviewListProps = {
  id: string;
  title: string;
  reviews: Review[];
  labels: ReviewLabels;
  layout?: "list" | "grid";
  item?: "card" | "plain";
  avatar?: "none" | "image";
  tone?: "default" | "muted";
  density?: "default" | "roomy";
  landmarkLabel?: string;
};

export function ReviewList({
  id,
  title,
  reviews,
  labels,
  layout = "list",
  item = "card",
  avatar = "none",
  tone = "default",
  density = "default",
  landmarkLabel,
}: ReviewListProps) {
  return (
    <SectionFrame
      id={id}
      title={title}
      tone={tone}
      density={density}
      measure={(((layout as string) === "list") ? "2xl" : "default")}
      landmarkLabel={landmarkLabel}
    >
      {((reviews?.length ?? 0) === 0) ? (
        <EmptyState icon="message-square-quote" title={labels.empty} />
      ) : null}
      <Grid cols={(((layout as string) === "grid") ? "1-3" : "1")} class="gap-4" data-slot="items">
        <For each={reviews ?? []}>{(r) => (
          <ArticleBlock
            class={cn(
              "flex h-full flex-col gap-4",
              (
                (item as string) === "card" ? "rounded bg-card p-6 inset-ring inset-ring-border"
                : "border-b border-border pb-4"
              )
            )}
            testid="item"
          >
            <Rating value={r.rating} label={tpl(labels.ratingLabel, r.rating)} />
            <Title as={3} size="base" weight="bold">
              {r.title}
            </Title>
            <Text size="sm" class="text-muted-foreground">
              {r.text}
            </Text>
            <Group gap="4" align="center" class="mt-auto">
              {((avatar as string) === "image") ? (
                <MediaFrame alt={r.author} ratio="1/1" class="size-10 shrink-0 rounded-full" />
              ) : null}
              <Stack gap="0">
                <Text size="sm" weight="semibold">
                  {r.author}
                </Text>
                <Text size="xs" class="text-muted-foreground">
                  {r.date}
                </Text>
              </Stack>
            </Group>
          </ArticleBlock>
        )}</For>
      </Grid>
    </SectionFrame>
  );
}
blocks/review-list.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 Review = {
  id: string;
  title: string;
  author: string;
  rating: number;
  text: string;
  date: string;
};

export type ReviewLabels = {
  ratingLabel: string;
  empty: 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 review-list
blocks/review-list.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/review-list.json

package blocks

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

// ReviewListProps are the props of ReviewList; the values are the JSON shapes of the TypeScript props.
type ReviewListProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Reviews any `json:"reviews"`
	Labels any `json:"labels"`
	Layout any `json:"layout"`
	Item any `json:"item"`
	Avatar any `json:"avatar"`
	Tone any `json:"tone"`
	Density any `json:"density"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// Customer reviews as cards or plain entries: rating, title, text, author and date. Axes: layout (list, grid), columns, item (card, plain), avatar (none, image), tone, density.
templ ReviewList(p ReviewListProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vReviews := p.Reviews }}
	{{ vLabels := p.Labels }}
	{{ vLayout := uiutils.Def(p.Layout, "list") }}
	{{ vItem := uiutils.Def(p.Item, "card") }}
	{{ vAvatar := uiutils.Def(p.Avatar, "none") }}
	{{ 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, Measure: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "list")), "2xl", "default"), LandmarkLabel: vLandmarkLabel}) {
		if uiutils.Eq(uiutils.Len(vReviews), float64(0)) {
			@EmptyState(EmptyStateProps{Icon: "message-square-quote", Title: uiutils.Get(vLabels, "empty")})
		}
		@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "grid")), "1-3", "1")), BoxProps: box.BoxProps{Class: "gap-4", Attrs: uiutils.Attrs("data-slot", "items")}}) {
			for _, vR := range uiutils.L(vReviews) {
				@ArticleBlock(ArticleBlockProps{Class: uiutils.Cnv(uiutils.Cnv("flex h-full flex-col gap-4", uiutils.Cond(uiutils.T(uiutils.Eq(vItem, "card")), "rounded bg-card p-6 inset-ring inset-ring-border", "border-b border-border pb-4"))), Testid: "item"}) {
					@Rating(RatingProps{Value: uiutils.Get(vR, "rating"), Label: uiutils.Tpl(uiutils.Get(vLabels, "ratingLabel"), uiutils.Get(vR, "rating"))})
					@compose.Title(compose.TitleProps{As: "3", Size: "base", Weight: "bold", TextProps: text.TextProps{}}) {
						{ uiutils.Text(uiutils.Get(vR, "title")) }
					}
					@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
						{ uiutils.Text(uiutils.Get(vR, "text")) }
					}
					@compose.Group(compose.GroupProps{Gap: "4", Align: "center", BoxProps: box.BoxProps{Class: "mt-auto"}}) {
						if uiutils.Eq(vAvatar, "image") {
							@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vR, "author"), Ratio: "1/1", Class: uiutils.Cnv("size-10 shrink-0 rounded-full")})
						}
						@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{}}) {
							@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
								{ uiutils.Text(uiutils.Get(vR, "author")) }
							}
							@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
								{ uiutils.Text(uiutils.Get(vR, "date")) }
							}
						}
					}
				}
			}
		}
	}
}

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 review-list
blocks/review-list.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/review-list.json
    Customer reviews as cards or plain entries: rating, title, text, author and date. Axes: layout (list, grid), columns, item (card, plain), avatar (none, image), tone, density.
    Props (p): id, title, reviews, labels, layout, item, avatar, tone, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_reviews = (p.reviews ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_layout = (p.layout ?? 'list') -%}
{%- set v_item = (p.item ?? 'card') -%}
{%- set v_avatar = (p.avatar ?? 'none') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_9 -%}
  {%- if og_t(og_eq(og_len(v_reviews), 0)) %}
    {{ include('blocks/empty-state.html.twig', {'p': {'icon': 'message-square-quote', 'title': og_get(v_labels, ['empty'])}}, with_context = false) }}
  {%- endif %}
  {%- set c_8 -%}
    {%- for v_r in og_l(v_reviews) %}
      {%- set c_7 -%}
        {{ include('blocks/rating.html.twig', {'p': {'value': og_get(v_r, ['rating']), 'label': og_tpl(og_get(v_labels, ['ratingLabel']), [og_get(v_r, ['rating'])])}}, with_context = false) }}
        {%- set c_1 -%}
          {{ og_text(og_get(v_r, ['title'])) }}
        {%- endset -%}
        {{ include('compose/Title.html.twig', {'as': 3, 'size': 'base', 'weight': 'bold', 'children': c_1}, with_context = false) }}
        {%- set c_2 -%}
          {{ og_text(og_get(v_r, ['text'])) }}
        {%- endset -%}
        {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
        {%- set c_6 -%}
          {%- if og_t(og_eq(v_avatar, 'image')) %}
            {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_r, ['author']), 'ratio': '1/1', 'className': og_cnv(['size-10 shrink-0 rounded-full'])}}, with_context = false) }}
          {%- endif %}
          {%- set c_5 -%}
            {%- set c_3 -%}
              {{ og_text(og_get(v_r, ['author'])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_3}, with_context = false) }}
            {%- set c_4 -%}
              {{ og_text(og_get(v_r, ['date'])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_4}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Stack.html.twig', {'gap': '0', 'children': c_5}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'class': 'mt-auto', 'children': c_6}, with_context = false) }}
      {%- endset -%}
      {{ include('blocks/article-block.html.twig', {'p': {'className': og_cnv([og_cnv(['flex h-full flex-col gap-4', (og_t(og_eq(v_item, 'card')) ? 'rounded bg-card p-6 inset-ring inset-ring-border' : 'border-b border-border pb-4')])]), 'testid': 'item'}, 'children': og_markup(c_7)}, with_context = false) }}
    {%- endfor %}
  {%- endset -%}
  {{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_layout, 'grid')) ? '1-3' : '1')), 'class': 'gap-4', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_8}, with_context = false) }}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'measure': (og_t(og_eq(v_layout, 'list')) ? '2xl' : 'default'), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_9)}, 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 review-list
blocks/review-list.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/review-list.json
    Customer reviews as cards or plain entries: rating, title, text, author and date. Axes: layout (list, grid), columns, item (card, plain), avatar (none, image), tone, density.
    Props (p): id, title, reviews, labels, layout, item, avatar, tone, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_reviews = ($p['reviews'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'list')}
{var $v_item = ($p['item'] ?? 'card')}
{var $v_avatar = ($p['avatar'] ?? 'none')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_9}
  {if og_t(og_eq(og_len($v_reviews), 0))}
    {=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'message-square-quote', 'title' => og_get($v_labels, ['empty'])]])|noescape}
  {/if}
  {capture $c_8}
    {foreach og_l($v_reviews) as $v_r}
      {capture $c_7}
        {=og_include('blocks/rating.latte', ['p' => ['value' => og_get($v_r, ['rating']), 'label' => og_tpl(og_get($v_labels, ['ratingLabel']), [og_get($v_r, ['rating'])])]])|noescape}
        {capture $c_1}
          {=og_text(og_get($v_r, ['title']))}
        {/capture}
        {=og_include('compose/Title.latte', ['as' => 3, 'size' => 'base', 'weight' => 'bold', 'children' => (string) $c_1])|noescape}
        {capture $c_2}
          {=og_text(og_get($v_r, ['text']))}
        {/capture}
        {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
        {capture $c_6}
          {if og_t(og_eq($v_avatar, 'image'))}
            {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_r, ['author']), 'ratio' => '1/1', 'className' => og_cnv(['size-10 shrink-0 rounded-full'])]])|noescape}
          {/if}
          {capture $c_5}
            {capture $c_3}
              {=og_text(og_get($v_r, ['author']))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_3])|noescape}
            {capture $c_4}
              {=og_text(og_get($v_r, ['date']))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_4])|noescape}
          {/capture}
          {=og_include('compose/Stack.latte', ['gap' => '0', 'children' => (string) $c_5])|noescape}
        {/capture}
        {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'class' => 'mt-auto', 'children' => (string) $c_6])|noescape}
      {/capture}
      {=og_include('blocks/article-block.latte', ['p' => ['className' => og_cnv([og_cnv(['flex h-full flex-col gap-4', (og_t(og_eq($v_item, 'card')) ? 'rounded bg-card p-6 inset-ring inset-ring-border' : 'border-b border-border pb-4')])]), 'testid' => 'item'], 'children' => og_markup($c_7)])|noescape}
    {/foreach}
  {/capture}
  {=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_layout, 'grid')) ? '1-3' : '1')), 'class' => 'gap-4', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_8])|noescape}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'density' => $v_density, 'measure' => (og_t(og_eq($v_layout, 'list')) ? '2xl' : 'default'), 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_9)])|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 review-list
blocks/review-list.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/review-list.json
    Customer reviews as cards or plain entries: rating, title, text, author and date. Axes: layout (list, grid), columns, item (card, plain), avatar (none, image), tone, density.
    Props (p): id, title, reviews, labels, layout, item, avatar, tone, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_reviews = og_def(p['reviews'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'list') -%}
{%- set v_item = og_def(p['item'], 'card') -%}
{%- set v_avatar = og_def(p['avatar'], 'none') -%}
{%- 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_9 -%}
  {%- if og_t(og_eq(og_len(v_reviews), 0)) %}
    {{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'message-square-quote', 'title': og_get(v_labels, ['empty'])}}) }}
  {%- endif %}
  {%- set c_8 -%}
    {%- for v_r in og_l(v_reviews) %}
      {%- set c_7 -%}
        {{ og_include('blocks/rating.html.j2', {'p': {'value': og_get(v_r, ['rating']), 'label': og_tpl(og_get(v_labels, ['ratingLabel']), [og_get(v_r, ['rating'])])}}) }}
        {%- set c_1 -%}
          {{ og_text(og_get(v_r, ['title'])) }}
        {%- endset -%}
        {{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'base', 'Weight': 'bold'}, 'children': c_1}) }}
        {%- set c_2 -%}
          {{ og_text(og_get(v_r, ['text'])) }}
        {%- endset -%}
        {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
        {%- set c_6 -%}
          {%- if og_t(og_eq(v_avatar, 'image')) %}
            {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_r, ['author']), 'ratio': '1/1', 'className': og_cnv(['size-10 shrink-0 rounded-full'])}}) }}
          {%- endif %}
          {%- set c_5 -%}
            {%- set c_3 -%}
              {{ og_text(og_get(v_r, ['author'])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_3}) }}
            {%- set c_4 -%}
              {{ og_text(og_get(v_r, ['date'])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_4}) }}
          {%- endset -%}
          {{ og_include('compose/stack.html.j2', {'p': {'Gap': '0'}, 'children': c_5}) }}
        {%- endset -%}
        {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Class': 'mt-auto'}, 'children': c_6}) }}
      {%- endset -%}
      {{ og_include('blocks/article-block.html.j2', {'p': {'className': og_cnv([og_cnv(['flex h-full flex-col gap-4', ('rounded bg-card p-6 inset-ring inset-ring-border' if og_t(og_eq(v_item, 'card')) else 'border-b border-border pb-4')])]), 'testid': 'item'}, 'children': og_markup(c_7)}) }}
    {%- endfor %}
  {%- endset -%}
  {{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(('1-3' if og_t(og_eq(v_layout, 'grid')) else '1')), 'Class': 'gap-4', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_8}) }}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'measure': ('2xl' if og_t(og_eq(v_layout, 'list')) else 'default'), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_9)}) }}

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.

Customer reviews as cards or plain entries: rating, title, text, author and date. Axes: layout (list, grid), columns, item (card, plain), avatar (none, image), tone, density.

Props of ReviewList
PropTypeDefault Description
id (required)string-
title (required)string-
reviews (required)Review[]-
labels (required)ReviewLabels-
layout "list" | "grid""list"
item "card" | "plain""card"
avatar "none" | "image""none"
tone "default" | "muted""default"
density "default" | "roomy""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

Used in