Testimonial Grid
Customer quotes as cards or plain figures.
Install
npx ui8kit add testimonial-gridPulls in: block, compose, empty-state, grid, kit-box, quote-card, section-frame, utils
Preview
What customers say
We moved our marketing site in a week and the pages got faster.
Mara Quinn
Head of Growth, Lumen
Every page reads the same data, so nothing drifts between teams.
Jon Ellis
Engineering Lead, Harbor
The structure is clear, so new people ship on their first day.
Aya Tanaka
Product Designer, Summit
Support answers in minutes and the docs are short and exact.
Luis Ortega
Operations, Orbit
Code
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdnnpx ui8kit add testimonial-grid<!-- 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 quotes as cards, plain figures or social posts, in a grid, a masonry, a scroll strip, one featured
quote or one narrow column. Axes: layout (grid, single, stack, masonry, strip), columns, item kind (card,
plain, social), item avatar, item rating, item mark (a company glyph), density, tone. A carousel is the
Carousel port contract around the single layout.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Quote, QuoteLabels, QuoteItem } from "./testimonial-grid.types";
export type TestimonialGridProps = {
id: string;
title: string;
quotes: Quote[];
empty?: string;
labels: QuoteLabels;
layout?: "grid" | "single" | "stack" | "masonry" | "strip";
cols?: "1-2" | "1-3";
item?: QuoteItem;
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Block from "../compose/Block.svelte";
import Grid from "../compose/Grid.svelte";
import EmptyState from "../components/empty-state.svelte";
import QuoteCard from "../components/quote-card.svelte";
import SectionFrame from "../components/section-frame.svelte";
let {
id,
title,
quotes,
empty = "",
labels,
layout = "grid",
cols = "1-3",
item,
tone = "default",
density = "default",
landmarkLabel,
}: TestimonialGridProps = $props();
</script>
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
align={(((layout as string) === "single") ? "center" : "start")}
measure={(((layout as string) === "grid") ? "default" : "2xl")}
landmarkLabel={landmarkLabel}
>
{#if ((quotes?.length ?? 0) === 0)}
<EmptyState icon="message-square-quote" title={empty} />
{:else if (((layout as string) === "masonry") || ((layout as string) === "strip"))}
<Block
tag="div"
class={
(layout as string) === "masonry" ? "columns-1 gap-4 md:columns-2 xl:columns-3"
: "flex snap-x gap-4 overflow-x-auto pb-2"
}
data-slot="items"
>
{#each quotes as q (q.id)}
<QuoteCard q={q} labels={labels} item={item} layout={layout} />
{/each}
</Block>
{:else}
<Grid cols={(((layout as string) === "grid") ? cols : "1")} class="gap-4" data-slot="items">
{#each quotes as q, i (q.id)}
{#if (((layout as string) !== "single") || (i === 0))}
<QuoteCard q={q} labels={labels} item={item} layout={layout} />
{/if}
{/each}
</Grid>
{/if}
</SectionFrame>
// 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 Quote = {
id: string;
author: string;
role: string;
company: string;
quote: string;
rating: number;
handle: string;
time: string;
mark: string;
image?: string;
};
export type QuoteLabels = {
/** template of the rating's accessible name, e.g. `{0} out of 5` */
rating: string;
/** template of the line under the author, e.g. `{0}, {1}` (role, company) */
byLine: string;
/** template of the line under a social author, e.g. `{0} / {1}` (handle, time) */
handleLine: string;
};
export type QuoteItem = {
/** card: boxed; plain: a bare figure; social: a post of a social wall */
kind?: "card" | "plain" | "social";
/** a round picture of the author */
avatar?: "none" | "image";
/** the stars (not on social posts) */
rating?: "show" | "hide";
/** a company glyph above the quote */
mark?: "none" | "icon";
};
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-cdnnpx ui8kit add testimonial-grid// 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 quotes as cards, plain figures or social posts, in a grid, a masonry, a scroll strip, one featured
* quote or one narrow column. Axes: layout (grid, single, stack, masonry, strip), columns, item kind (card,
* plain, social), item avatar, item rating, item mark (a company glyph), density, tone. A carousel is the
* Carousel port contract around the single layout.
*/
import { Fragment, type ReactNode } from "react";
import { Block, Grid } from "../compose";
import { EmptyState } from "../components/empty-state";
import { QuoteCard } from "../components/quote-card";
import { SectionFrame } from "../components/section-frame";
import type { Quote, QuoteLabels, QuoteItem } from "./testimonial-grid.types";
export type TestimonialGridProps = {
id: string;
title: string;
quotes: Quote[];
empty?: string;
labels: QuoteLabels;
layout?: "grid" | "single" | "stack" | "masonry" | "strip";
cols?: "1-2" | "1-3";
item?: QuoteItem;
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
landmarkLabel?: string;
};
export function TestimonialGrid({
id,
title,
quotes,
empty = "",
labels,
layout = "grid",
cols = "1-3",
item,
tone = "default",
density = "default",
landmarkLabel,
}: TestimonialGridProps) {
return (
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
align={(((layout as string) === "single") ? "center" : "start")}
measure={(((layout as string) === "grid") ? "default" : "2xl")}
landmarkLabel={landmarkLabel}
>
{((quotes?.length ?? 0) === 0) ? (
<EmptyState icon="message-square-quote" title={empty} />
) : (((layout as string) === "masonry") || ((layout as string) === "strip")) ? (
<Block
tag="div"
className={
(layout as string) === "masonry" ? "columns-1 gap-4 md:columns-2 xl:columns-3"
: "flex snap-x gap-4 overflow-x-auto pb-2"
}
data-slot="items"
>
{(quotes ?? []).map((q) => (
<QuoteCard key={q.id} q={q} labels={labels} item={item} layout={layout} />
))}
</Block>
) : (
<Grid cols={(((layout as string) === "grid") ? cols : "1")} className="gap-4" data-slot="items">
{(quotes ?? []).map((q, i) => (
<Fragment key={q.id}>
{(((layout as string) !== "single") || (i === 0)) ? (
<QuoteCard q={q} labels={labels} item={item} layout={layout} />
) : null}
</Fragment>
))}
</Grid>
)}
</SectionFrame>
);
}
// 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 Quote = {
id: string;
author: string;
role: string;
company: string;
quote: string;
rating: number;
handle: string;
time: string;
mark: string;
image?: string;
};
export type QuoteLabels = {
/** template of the rating's accessible name, e.g. `{0} out of 5` */
rating: string;
/** template of the line under the author, e.g. `{0}, {1}` (role, company) */
byLine: string;
/** template of the line under a social author, e.g. `{0} / {1}` (handle, time) */
handleLine: string;
};
export type QuoteItem = {
/** card: boxed; plain: a bare figure; social: a post of a social wall */
kind?: "card" | "plain" | "social";
/** a round picture of the author */
avatar?: "none" | "image";
/** the stars (not on social posts) */
rating?: "show" | "hide";
/** a company glyph above the quote */
mark?: "none" | "icon";
};
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-cdnnpx ui8kit add testimonial-grid// 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 Quote = {
id: string;
author: string;
role: string;
company: string;
quote: string;
rating: number;
handle: string;
time: string;
mark: string;
image?: string;
};
export type QuoteLabels = {
/** template of the rating's accessible name, e.g. `{0} out of 5` */
rating: string;
/** template of the line under the author, e.g. `{0}, {1}` (role, company) */
byLine: string;
/** template of the line under a social author, e.g. `{0} / {1}` (handle, time) */
handleLine: string;
};
export type QuoteItem = {
/** card: boxed; plain: a bare figure; social: a post of a social wall */
kind?: "card" | "plain" | "social";
/** a round picture of the author */
avatar?: "none" | "image";
/** the stars (not on social posts) */
rating?: "show" | "hide";
/** a company glyph above the quote */
mark?: "none" | "icon";
};
<!-- 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 quotes as cards, plain figures or social posts, in a grid, a masonry, a scroll strip, one featured
quote or one narrow column. Axes: layout (grid, single, stack, masonry, strip), columns, item kind (card,
plain, social), item avatar, item rating, item mark (a company glyph), density, tone. A carousel is the
Carousel port contract around the single layout.
-->
<script lang="ts">
import type { Quote, QuoteLabels, QuoteItem } from "./testimonial-grid.types";
export type TestimonialGridProps = {
id: string;
title: string;
quotes: Quote[];
empty?: string;
labels: QuoteLabels;
layout?: "grid" | "single" | "stack" | "masonry" | "strip";
cols?: "1-2" | "1-3";
item?: QuoteItem;
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Block from "../compose/Block.vue";
import Grid from "../compose/Grid.vue";
import EmptyState from "../components/empty-state.vue";
import QuoteCard from "../components/quote-card.vue";
import SectionFrame from "../components/section-frame.vue";
const {
id,
title,
quotes,
empty = "",
labels,
layout = "grid",
cols = "1-3",
item,
tone = "default",
density = "default",
landmarkLabel,
} = defineProps<TestimonialGridProps>();
</script>
<template>
<SectionFrame
:id="id"
:title="title"
:tone="tone"
:density="density"
:align="(((layout as string) === 'single') ? 'center' : 'start')"
:measure="(((layout as string) === 'grid') ? 'default' : '2xl')"
:landmarkLabel="landmarkLabel"
>
<EmptyState v-if="((quotes?.length ?? 0) === 0)" icon="message-square-quote" :title="empty" />
<Block v-else-if="(((layout as string) === 'masonry') || ((layout as string) === 'strip'))"
tag="div"
:class="
(layout as string) === 'masonry' ? 'columns-1 gap-4 md:columns-2 xl:columns-3'
: 'flex snap-x gap-4 overflow-x-auto pb-2'
"
data-slot="items"
>
<QuoteCard v-for="q in quotes" :key="q.id" :q="q" :labels="labels" :item="item" :layout="layout" />
</Block>
<Grid v-else :cols="(((layout as string) === 'grid') ? cols : '1')" class="gap-4" data-slot="items">
<template v-for="(q, i) in quotes" :key="q.id">
<QuoteCard
v-if="(((layout as string) !== 'single') || (i === 0))"
:q="q"
:labels="labels"
:item="item"
:layout="layout"
/>
</template>
</Grid>
</SectionFrame>
</template>
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-cdnnpx ui8kit add testimonial-grid// 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 quotes as cards, plain figures or social posts, in a grid, a masonry, a scroll strip, one featured
* quote or one narrow column. Axes: layout (grid, single, stack, masonry, strip), columns, item kind (card,
* plain, social), item avatar, item rating, item mark (a company glyph), density, tone. A carousel is the
* Carousel port contract around the single layout.
*/
import { For, type JSX } from "solid-js";
import { Block, Grid } from "../compose";
import { EmptyState } from "../components/empty-state";
import { QuoteCard } from "../components/quote-card";
import { SectionFrame } from "../components/section-frame";
import type { Quote, QuoteLabels, QuoteItem } from "./testimonial-grid.types";
export type TestimonialGridProps = {
id: string;
title: string;
quotes: Quote[];
empty?: string;
labels: QuoteLabels;
layout?: "grid" | "single" | "stack" | "masonry" | "strip";
cols?: "1-2" | "1-3";
item?: QuoteItem;
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
landmarkLabel?: string;
};
export function TestimonialGrid({
id,
title,
quotes,
empty = "",
labels,
layout = "grid",
cols = "1-3",
item,
tone = "default",
density = "default",
landmarkLabel,
}: TestimonialGridProps) {
return (
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
align={(((layout as string) === "single") ? "center" : "start")}
measure={(((layout as string) === "grid") ? "default" : "2xl")}
landmarkLabel={landmarkLabel}
>
{((quotes?.length ?? 0) === 0) ? (
<EmptyState icon="message-square-quote" title={empty} />
) : (((layout as string) === "masonry") || ((layout as string) === "strip")) ? (
<Block
tag="div"
class={
(layout as string) === "masonry" ? "columns-1 gap-4 md:columns-2 xl:columns-3"
: "flex snap-x gap-4 overflow-x-auto pb-2"
}
data-slot="items"
>
<For each={quotes ?? []}>{(q) => (
<QuoteCard q={q} labels={labels} item={item} layout={layout} />
)}</For>
</Block>
) : (
<Grid cols={(((layout as string) === "grid") ? cols : "1")} class="gap-4" data-slot="items">
<For each={quotes ?? []}>{(q, iOf) => { const i = iOf(); return (
<>
{(((layout as string) !== "single") || (i === 0)) ? (
<QuoteCard q={q} labels={labels} item={item} layout={layout} />
) : null}
</>
); }}</For>
</Grid>
)}
</SectionFrame>
);
}
// 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 Quote = {
id: string;
author: string;
role: string;
company: string;
quote: string;
rating: number;
handle: string;
time: string;
mark: string;
image?: string;
};
export type QuoteLabels = {
/** template of the rating's accessible name, e.g. `{0} out of 5` */
rating: string;
/** template of the line under the author, e.g. `{0}, {1}` (role, company) */
byLine: string;
/** template of the line under a social author, e.g. `{0} / {1}` (handle, time) */
handleLine: string;
};
export type QuoteItem = {
/** card: boxed; plain: a bare figure; social: a post of a social wall */
kind?: "card" | "plain" | "social";
/** a round picture of the author */
avatar?: "none" | "image";
/** the stars (not on social posts) */
rating?: "show" | "hide";
/** a company glyph above the quote */
mark?: "none" | "icon";
};
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-cdnnpx ui8kit add testimonial-grid// 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/testimonial-grid.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/compose"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// TestimonialGridProps are the props of TestimonialGrid; the values are the JSON shapes of the TypeScript props.
type TestimonialGridProps struct {
Id any `json:"id"`
Title any `json:"title"`
Quotes any `json:"quotes"`
Empty any `json:"empty"`
Labels any `json:"labels"`
Layout any `json:"layout"`
Cols any `json:"cols"`
Item any `json:"item"`
Tone any `json:"tone"`
Density any `json:"density"`
LandmarkLabel any `json:"landmarkLabel"`
}
// Customer quotes as cards, plain figures or social posts, in a grid, a masonry, a scroll strip, one featured quote or one narrow column. Axes: layout (grid, single, stack, masonry, strip), columns, item kind (card, plain, social), item avatar, item rating, item mark (a company glyph), density, tone. A carousel is the Carousel port contract around the single layout.
templ TestimonialGrid(p TestimonialGridProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vQuotes := p.Quotes }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vLabels := p.Labels }}
{{ vLayout := uiutils.Def(p.Layout, "grid") }}
{{ vCols := uiutils.Def(p.Cols, "1-3") }}
{{ vItem := p.Item }}
{{ 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, Align: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "single")), "center", "start"), Measure: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "grid")), "default", "2xl"), LandmarkLabel: vLandmarkLabel}) {
if uiutils.Eq(uiutils.Len(vQuotes), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "message-square-quote", Title: vEmpty})
} else if uiutils.T(uiutils.Or(uiutils.Eq(vLayout, "masonry"), uiutils.Eq(vLayout, "strip"))) {
@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "div", Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "masonry")), "columns-1 gap-4 md:columns-2 xl:columns-3", "flex snap-x gap-4 overflow-x-auto pb-2")), Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vQ := range uiutils.L(vQuotes) {
@QuoteCard(QuoteCardProps{Q: vQ, Labels: vLabels, Item: vItem, Layout: vLayout})
}
}
} else {
@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "grid")), vCols, "1")), BoxProps: box.BoxProps{Class: "gap-4", Attrs: uiutils.Attrs("data-slot", "items")}}) {
for vI, vQ := range uiutils.L(vQuotes) {
if uiutils.T(uiutils.Or(!uiutils.Eq(vLayout, "single"), uiutils.Eq(float64(vI), float64(0)))) {
@QuoteCard(QuoteCardProps{Q: vQ, Labels: vLabels, Item: vItem, Layout: vLayout})
}
}
}
}
}
}
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-cdnnpx ui8kit add testimonial-grid{#- 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/testimonial-grid.json
Customer quotes as cards, plain figures or social posts, in a grid, a masonry, a scroll strip, one featured quote or one narrow column. Axes: layout (grid, single, stack, masonry, strip), columns, item kind (card, plain, social), item avatar, item rating, item mark (a company glyph), density, tone. A carousel is the Carousel port contract around the single layout.
Props (p): id, title, quotes, empty, labels, layout, cols, item, tone, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_quotes = (p.quotes ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_layout = (p.layout ?? 'grid') -%}
{%- set v_cols = (p.cols ?? '1-3') -%}
{%- set v_item = (p.item ?? null) -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_3 -%}
{%- if og_t(og_eq(og_len(v_quotes), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'message-square-quote', 'title': v_empty}}, with_context = false) }}
{%- elseif og_t(og_or([og_eq(v_layout, 'masonry'), og_eq(v_layout, 'strip')])) %}
{%- set c_1 -%}
{%- for v_q in og_l(v_quotes) %}
{{ include('blocks/quote-card.html.twig', {'p': {'q': v_q, 'labels': v_labels, 'item': v_item, 'layout': v_layout}}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'div', 'class': og_s((og_t(og_eq(v_layout, 'masonry')) ? 'columns-1 gap-4 md:columns-2 xl:columns-3' : 'flex snap-x gap-4 overflow-x-auto pb-2')), 'attrs': og_attrs(['data-slot', 'items']), 'children': c_1}, with_context = false) }}
{%- else %}
{%- set c_2 -%}
{%- for v_q in og_l(v_quotes) %}
{%- set v_i = loop.index0 -%}
{%- if og_t(og_or([not (og_eq(v_layout, 'single')), og_eq(v_i, 0)])) %}
{{ include('blocks/quote-card.html.twig', {'p': {'q': v_q, 'labels': v_labels, 'item': v_item, 'layout': v_layout}}, with_context = false) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_layout, 'grid')) ? v_cols : '1')), 'class': 'gap-4', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_2}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'align': (og_t(og_eq(v_layout, 'single')) ? 'center' : 'start'), 'measure': (og_t(og_eq(v_layout, 'grid')) ? 'default' : '2xl'), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_3)}, with_context = false) }}
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-cdnnpx ui8kit add testimonial-grid{* 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/testimonial-grid.json
Customer quotes as cards, plain figures or social posts, in a grid, a masonry, a scroll strip, one featured quote or one narrow column. Axes: layout (grid, single, stack, masonry, strip), columns, item kind (card, plain, social), item avatar, item rating, item mark (a company glyph), density, tone. A carousel is the Carousel port contract around the single layout.
Props (p): id, title, quotes, empty, labels, layout, cols, item, tone, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_quotes = ($p['quotes'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'grid')}
{var $v_cols = ($p['cols'] ?? '1-3')}
{var $v_item = ($p['item'] ?? null)}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_3}
{if og_t(og_eq(og_len($v_quotes), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'message-square-quote', 'title' => $v_empty]])|noescape}
{elseif og_t(og_or([og_eq($v_layout, 'masonry'), og_eq($v_layout, 'strip')]))}
{capture $c_1}
{foreach og_l($v_quotes) as $v_q}
{=og_include('blocks/quote-card.latte', ['p' => ['q' => $v_q, 'labels' => $v_labels, 'item' => $v_item, 'layout' => $v_layout]])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'div', 'class' => og_s((og_t(og_eq($v_layout, 'masonry')) ? 'columns-1 gap-4 md:columns-2 xl:columns-3' : 'flex snap-x gap-4 overflow-x-auto pb-2')), 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_1])|noescape}
{else}
{capture $c_2}
{foreach og_l($v_quotes) as $v_q}
{var $v_i = $iterator->counter0}
{if og_t(og_or([!(og_eq($v_layout, 'single')), og_eq($v_i, 0)]))}
{=og_include('blocks/quote-card.latte', ['p' => ['q' => $v_q, 'labels' => $v_labels, 'item' => $v_item, 'layout' => $v_layout]])|noescape}
{/if}
{/foreach}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_layout, 'grid')) ? $v_cols : '1')), 'class' => 'gap-4', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_2])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'density' => $v_density, 'align' => (og_t(og_eq($v_layout, 'single')) ? 'center' : 'start'), 'measure' => (og_t(og_eq($v_layout, 'grid')) ? 'default' : '2xl'), 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_3)])|noescape}
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-cdnnpx ui8kit add testimonial-grid{#- 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/testimonial-grid.json
Customer quotes as cards, plain figures or social posts, in a grid, a masonry, a scroll strip, one featured quote or one narrow column. Axes: layout (grid, single, stack, masonry, strip), columns, item kind (card, plain, social), item avatar, item rating, item mark (a company glyph), density, tone. A carousel is the Carousel port contract around the single layout.
Props (p): id, title, quotes, empty, labels, layout, cols, item, tone, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_quotes = og_def(p['quotes'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'grid') -%}
{%- set v_cols = og_def(p['cols'], '1-3') -%}
{%- set v_item = og_def(p['item'], 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_3 -%}
{%- if og_t(og_eq(og_len(v_quotes), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'message-square-quote', 'title': v_empty}}) }}
{%- elif og_t(og_or([og_eq(v_layout, 'masonry'), og_eq(v_layout, 'strip')])) %}
{%- set c_1 -%}
{%- for v_q in og_l(v_quotes) %}
{{ og_include('blocks/quote-card.html.j2', {'p': {'q': v_q, 'labels': v_labels, 'item': v_item, 'layout': v_layout}}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'div', 'Class': og_s(('columns-1 gap-4 md:columns-2 xl:columns-3' if og_t(og_eq(v_layout, 'masonry')) else 'flex snap-x gap-4 overflow-x-auto pb-2')), 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_1}) }}
{%- else %}
{%- set c_2 -%}
{%- for v_q in og_l(v_quotes) %}
{%- set v_i = loop.index0 -%}
{%- if og_t(og_or([not (og_eq(v_layout, 'single')), og_eq(v_i, 0)])) %}
{{ og_include('blocks/quote-card.html.j2', {'p': {'q': v_q, 'labels': v_labels, 'item': v_item, 'layout': v_layout}}) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s((v_cols if og_t(og_eq(v_layout, 'grid')) else '1')), 'Class': 'gap-4', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_2}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'align': ('center' if og_t(og_eq(v_layout, 'single')) else 'start'), 'measure': ('default' if og_t(og_eq(v_layout, 'grid')) else '2xl'), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_3)}) }}
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 quotes as cards, plain figures or social posts, in a grid, a masonry, a scroll strip, one featured quote or one narrow column. Axes: layout (grid, single, stack, masonry, strip), columns, item kind (card, plain, social), item avatar, item rating, item mark (a company glyph), density, tone. A carousel is the Carousel port contract around the single layout.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| quotes (required) | Quote[] | - | |
| empty | string | "" | the text of the empty state (no records), from the dictionary |
| labels (required) | QuoteLabels | - | the templates of the lines around a quote |
| layout | "grid" | "single" | "stack" | "masonry" | "strip" | "grid" | single: the first quote only, wide; stack: one narrow column; masonry: columns of cards of any height; strip: one row that scrolls sideways |
| cols | "1-2" | "1-3" | "1-3" | |
| item | QuoteItem | - | how one quote is drawn |
| tone | "default" | "muted" | "default" | |
| density | "roomy" | "default" | "compact" | "default" | |
| landmarkLabel | string | - | accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one |