Quote Card
Quote Card component
Install
npx ui8kit add quote-cardPulls in: compose, figure-block, group, inline, kit-box, kit-text, lucide-icon, media-frame, rating, stack, testimonial-grid, text, utils
Preview
Every page reads the same data, so nothing drifts between teams.
Jon Ellis
Engineering Lead, Harbor
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 quote-card<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
One customer quote of TestimonialGrid: a card, a plain figure or a social post, with the author's picture, the
stars and a company glyph as `item` says.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Quote, QuoteLabels, QuoteItem } from "../blocks/testimonial-grid.types";
export type QuoteCardProps = {
q: Quote;
labels: QuoteLabels;
item?: QuoteItem;
layout?: "grid" | "single" | "stack" | "masonry" | "strip";
};
</script>
<script lang="ts">
import Group from "../compose/Group.svelte";
import Inline from "../compose/Inline.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import FigureBlock from "../components/figure-block.svelte";
import MediaFrame from "../components/media-frame.svelte";
import Rating from "../components/rating.svelte";
import { cn, tpl } from "../utils";
let { q, labels, item, layout = "grid" }: QuoteCardProps = $props();
</script>
<FigureBlock
class={cn(
"m-0 flex flex-col gap-4",
((item?.kind === "plain") ? "" : "rounded p-6 inset-ring inset-ring-border bg-card"),
(
(layout as string) === "masonry" ? "mb-4 break-inside-avoid"
: (layout as string) === "strip" ? "w-80 shrink-0 snap-start"
: "h-full"
)
)}
testid="item"
>
{#if (item?.kind === "social")}
<Group gap="4" align="center">
{#if (item?.avatar !== "none")}
<MediaFrame alt={q.author} src={q.image} ratio="1/1" class="size-12 shrink-0 rounded-full" />
{/if}
<Stack gap="0">
<Text size="sm" weight="semibold">
{q.author}
</Text>
<Text size="xs" class="text-muted-foreground">
{tpl(labels.handleLine, q.handle, q.time)}
</Text>
</Stack>
<LucideIcon name="message-circle" size={16} class="ml-auto text-muted-foreground" />
</Group>
<Text size="base">
{q.quote}
</Text>
{:else}
{#if (item?.rating !== "hide")}
<Rating value={q.rating} label={tpl(labels.rating, q.rating)} />
{/if}
{#if (item?.mark === "icon")}
<Inline class="text-muted-foreground" data-slot="mark">
<LucideIcon name={q.mark} size={24} />
</Inline>
{/if}
<Text size={(((layout as string) === "single") ? "xl" : "base")}>
{q.quote}
</Text>
<Group gap="4" align="center">
{#if (item?.avatar !== "none")}
<MediaFrame alt={q.author} src={q.image} ratio="1/1" class="size-12 shrink-0 rounded-full" />
{/if}
<Stack gap="0">
<Text size="sm" weight="semibold">
{q.author}
</Text>
<Text size="sm" class="text-muted-foreground">
{tpl(labels.byLine, q.role, q.company)}
</Text>
</Stack>
</Group>
{/if}
</FigureBlock>
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 quote-card// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* One customer quote of TestimonialGrid: a card, a plain figure or a social post, with the author's picture, the
* stars and a company glyph as `item` says.
*/
import { type ReactNode } from "react";
import { Group, Inline, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { FigureBlock } from "../components/figure-block";
import { MediaFrame } from "../components/media-frame";
import { Rating } from "../components/rating";
import { cn, tpl } from "../utils";
import type { Quote, QuoteLabels, QuoteItem } from "../blocks/testimonial-grid.types";
export type QuoteCardProps = {
q: Quote;
labels: QuoteLabels;
item?: QuoteItem;
layout?: "grid" | "single" | "stack" | "masonry" | "strip";
};
export function QuoteCard({ q, labels, item, layout = "grid" }: QuoteCardProps) {
return (
<FigureBlock
className={cn(
"m-0 flex flex-col gap-4",
((item?.kind === "plain") ? "" : "rounded p-6 inset-ring inset-ring-border bg-card"),
(
(layout as string) === "masonry" ? "mb-4 break-inside-avoid"
: (layout as string) === "strip" ? "w-80 shrink-0 snap-start"
: "h-full"
)
)}
testid="item"
>
{(item?.kind === "social") ? (
<>
<Group gap="4" align="center">
{(item?.avatar !== "none") ? (
<MediaFrame alt={q.author} src={q.image} ratio="1/1" className="size-12 shrink-0 rounded-full" />
) : null}
<Stack gap="0">
<Text size="sm" weight="semibold">
{q.author}
</Text>
<Text size="xs" className="text-muted-foreground">
{tpl(labels.handleLine, q.handle, q.time)}
</Text>
</Stack>
<LucideIcon name="message-circle" size={16} className="ml-auto text-muted-foreground" />
</Group>
<Text size="base">
{q.quote}
</Text>
</>
) : (
<>
{(item?.rating !== "hide") ? (
<Rating value={q.rating} label={tpl(labels.rating, q.rating)} />
) : null}
{(item?.mark === "icon") ? (
<Inline className="text-muted-foreground" data-slot="mark">
<LucideIcon name={q.mark} size={24} />
</Inline>
) : null}
<Text size={(((layout as string) === "single") ? "xl" : "base")}>
{q.quote}
</Text>
<Group gap="4" align="center">
{(item?.avatar !== "none") ? (
<MediaFrame alt={q.author} src={q.image} ratio="1/1" className="size-12 shrink-0 rounded-full" />
) : null}
<Stack gap="0">
<Text size="sm" weight="semibold">
{q.author}
</Text>
<Text size="sm" className="text-muted-foreground">
{tpl(labels.byLine, q.role, q.company)}
</Text>
</Stack>
</Group>
</>
)}
</FigureBlock>
);
}
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 quote-card<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
One customer quote of TestimonialGrid: a card, a plain figure or a social post, with the author's picture, the
stars and a company glyph as `item` says.
-->
<script lang="ts">
import type { Quote, QuoteLabels, QuoteItem } from "../blocks/testimonial-grid.types";
export type QuoteCardProps = {
q: Quote;
labels: QuoteLabels;
item?: QuoteItem;
layout?: "grid" | "single" | "stack" | "masonry" | "strip";
};
</script>
<script setup lang="ts">
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import FigureBlock from "../components/figure-block.vue";
import MediaFrame from "../components/media-frame.vue";
import Rating from "../components/rating.vue";
import { cn, tpl } from "../utils";
const { q, labels, item, layout = "grid" } = defineProps<QuoteCardProps>();
</script>
<template>
<FigureBlock
:class="cn(
'm-0 flex flex-col gap-4',
((item?.kind === 'plain') ? '' : 'rounded p-6 inset-ring inset-ring-border bg-card'),
(
(layout as string) === 'masonry' ? 'mb-4 break-inside-avoid'
: (layout as string) === 'strip' ? 'w-80 shrink-0 snap-start'
: 'h-full'
)
)"
testid="item"
>
<template v-if="(item?.kind === 'social')">
<Group gap="4" align="center">
<MediaFrame
v-if="(item?.avatar !== 'none')"
:alt="q.author"
:src="q.image"
ratio="1/1"
class="size-12 shrink-0 rounded-full"
/>
<Stack gap="0">
<Text size="sm" weight="semibold">
{{ q.author }}
</Text>
<Text size="xs" class="text-muted-foreground">
{{ tpl(labels.handleLine, q.handle, q.time) }}
</Text>
</Stack>
<LucideIcon name="message-circle" :size="16" class="ml-auto text-muted-foreground" />
</Group>
<Text size="base">
{{ q.quote }}
</Text>
</template>
<template v-else>
<Rating v-if="(item?.rating !== 'hide')" :value="q.rating" :label="tpl(labels.rating, q.rating)" />
<Inline v-if="(item?.mark === 'icon')" class="text-muted-foreground" data-slot="mark">
<LucideIcon :name="q.mark" :size="24" />
</Inline>
<Text :size="(((layout as string) === 'single') ? 'xl' : 'base')">
{{ q.quote }}
</Text>
<Group gap="4" align="center">
<MediaFrame
v-if="(item?.avatar !== 'none')"
:alt="q.author"
:src="q.image"
ratio="1/1"
class="size-12 shrink-0 rounded-full"
/>
<Stack gap="0">
<Text size="sm" weight="semibold">
{{ q.author }}
</Text>
<Text size="sm" class="text-muted-foreground">
{{ tpl(labels.byLine, q.role, q.company) }}
</Text>
</Stack>
</Group>
</template>
</FigureBlock>
</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 quote-card// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* One customer quote of TestimonialGrid: a card, a plain figure or a social post, with the author's picture, the
* stars and a company glyph as `item` says.
*/
import { type JSX } from "solid-js";
import { Group, Inline, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { FigureBlock } from "../components/figure-block";
import { MediaFrame } from "../components/media-frame";
import { Rating } from "../components/rating";
import { cn, tpl } from "../utils";
import type { Quote, QuoteLabels, QuoteItem } from "../blocks/testimonial-grid.types";
export type QuoteCardProps = {
q: Quote;
labels: QuoteLabels;
item?: QuoteItem;
layout?: "grid" | "single" | "stack" | "masonry" | "strip";
};
export function QuoteCard({ q, labels, item, layout = "grid" }: QuoteCardProps) {
return (
<FigureBlock
class={cn(
"m-0 flex flex-col gap-4",
((item?.kind === "plain") ? "" : "rounded p-6 inset-ring inset-ring-border bg-card"),
(
(layout as string) === "masonry" ? "mb-4 break-inside-avoid"
: (layout as string) === "strip" ? "w-80 shrink-0 snap-start"
: "h-full"
)
)}
testid="item"
>
{(item?.kind === "social") ? (
<>
<Group gap="4" align="center">
{(item?.avatar !== "none") ? (
<MediaFrame alt={q.author} src={q.image} ratio="1/1" class="size-12 shrink-0 rounded-full" />
) : null}
<Stack gap="0">
<Text size="sm" weight="semibold">
{q.author}
</Text>
<Text size="xs" class="text-muted-foreground">
{tpl(labels.handleLine, q.handle, q.time)}
</Text>
</Stack>
<LucideIcon name="message-circle" size={16} class="ml-auto text-muted-foreground" />
</Group>
<Text size="base">
{q.quote}
</Text>
</>
) : (
<>
{(item?.rating !== "hide") ? (
<Rating value={q.rating} label={tpl(labels.rating, q.rating)} />
) : null}
{(item?.mark === "icon") ? (
<Inline class="text-muted-foreground" data-slot="mark">
<LucideIcon name={q.mark} size={24} />
</Inline>
) : null}
<Text size={(((layout as string) === "single") ? "xl" : "base")}>
{q.quote}
</Text>
<Group gap="4" align="center">
{(item?.avatar !== "none") ? (
<MediaFrame alt={q.author} src={q.image} ratio="1/1" class="size-12 shrink-0 rounded-full" />
) : null}
<Stack gap="0">
<Text size="sm" weight="semibold">
{q.author}
</Text>
<Text size="sm" class="text-muted-foreground">
{tpl(labels.byLine, q.role, q.company)}
</Text>
</Stack>
</Group>
</>
)}
</FigureBlock>
);
}
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 quote-card// 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/quote-card.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/icons"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// QuoteCardProps are the props of QuoteCard; the values are the JSON shapes of the TypeScript props.
type QuoteCardProps struct {
Q any `json:"q"`
Labels any `json:"labels"`
Item any `json:"item"`
Layout any `json:"layout"`
}
// One customer quote of TestimonialGrid: a card, a plain figure or a social post, with the author's picture, the stars and a company glyph as `item` says.
templ QuoteCard(p QuoteCardProps) {
{{ vQ := p.Q }}
{{ vLabels := p.Labels }}
{{ vItem := p.Item }}
{{ vLayout := uiutils.Def(p.Layout, "grid") }}
@FigureBlock(FigureBlockProps{Class: uiutils.Cnv(uiutils.Cnv("m-0 flex flex-col gap-4", uiutils.Cond(uiutils.T(uiutils.Eq(uiutils.Get(vItem, "kind"), "plain")), "", "rounded p-6 inset-ring inset-ring-border bg-card"), uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "masonry")), "mb-4 break-inside-avoid", uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "strip")), "w-80 shrink-0 snap-start", "h-full")))), Testid: "item"}) {
if uiutils.Eq(uiutils.Get(vItem, "kind"), "social") {
@compose.Group(compose.GroupProps{Gap: "4", Align: "center", BoxProps: box.BoxProps{}}) {
if !uiutils.Eq(uiutils.Get(vItem, "avatar"), "none") {
@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vQ, "author"), Src: uiutils.Get(vQ, "image"), Ratio: "1/1", Class: uiutils.Cnv("size-12 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(vQ, "author")) }
}
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "handleLine"), uiutils.Get(vQ, "handle"), uiutils.Get(vQ, "time"))) }
}
}
@icons.LucideIcon(icons.LucideIconProps{Name: "message-circle", Size: 16, Class: "ml-auto text-muted-foreground"})
}
@compose.Text(compose.TextProps{Size: "base", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vQ, "quote")) }
}
} else {
if !uiutils.Eq(uiutils.Get(vItem, "rating"), "hide") {
@Rating(RatingProps{Value: uiutils.Get(vQ, "rating"), Label: uiutils.Tpl(uiutils.Get(vLabels, "rating"), uiutils.Get(vQ, "rating"))})
}
if uiutils.Eq(uiutils.Get(vItem, "mark"), "icon") {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-muted-foreground", Attrs: uiutils.Attrs("data-slot", "mark")}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vQ, "mark")), Size: 24})
}
}
@compose.Text(compose.TextProps{Size: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "single")), "xl", "base")), TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vQ, "quote")) }
}
@compose.Group(compose.GroupProps{Gap: "4", Align: "center", BoxProps: box.BoxProps{}}) {
if !uiutils.Eq(uiutils.Get(vItem, "avatar"), "none") {
@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vQ, "author"), Src: uiutils.Get(vQ, "image"), Ratio: "1/1", Class: uiutils.Cnv("size-12 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(vQ, "author")) }
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "byLine"), uiutils.Get(vQ, "role"), uiutils.Get(vQ, "company"))) }
}
}
}
}
}
}
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 quote-card{#- 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/quote-card.json
One customer quote of TestimonialGrid: a card, a plain figure or a social post, with the author's picture, the stars and a company glyph as `item` says.
Props (p): q, labels, item, layout. -#}
{%- set v_q = (p.q ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_item = (p.item ?? null) -%}
{%- set v_layout = (p.layout ?? 'grid') -%}
{%- set c_12 -%}
{%- if og_t(og_eq(og_get(v_item, ['kind']), 'social')) %}
{%- set c_4 -%}
{%- if og_t(not (og_eq(og_get(v_item, ['avatar']), 'none'))) %}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_q, ['author']), 'src': og_get(v_q, ['image']), 'ratio': '1/1', 'className': og_cnv(['size-12 shrink-0 rounded-full'])}}, with_context = false) }}
{%- endif %}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_q, ['author'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(og_tpl(og_get(v_labels, ['handleLine']), [og_get(v_q, ['handle']), og_get(v_q, ['time'])])) }}
{%- 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) }}
{{ include('icons/LucideIcon.html.twig', {'name': 'message-circle', 'size': 16, 'class': 'ml-auto text-muted-foreground'}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'children': c_4}, with_context = false) }}
{%- set c_5 -%}
{{ og_text(og_get(v_q, ['quote'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'base', 'children': c_5}, with_context = false) }}
{%- else %}
{%- if og_t(not (og_eq(og_get(v_item, ['rating']), 'hide'))) %}
{{ include('blocks/rating.html.twig', {'p': {'value': og_get(v_q, ['rating']), 'label': og_tpl(og_get(v_labels, ['rating']), [og_get(v_q, ['rating'])])}}, with_context = false) }}
{%- endif %}
{%- if og_t(og_eq(og_get(v_item, ['mark']), 'icon')) %}
{%- set c_6 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_q, ['mark'])), 'size': 24}, with_context = false) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-muted-foreground', 'attrs': og_attrs(['data-slot', 'mark']), 'children': c_6}, with_context = false) }}
{%- endif %}
{%- set c_7 -%}
{{ og_text(og_get(v_q, ['quote'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': og_s((og_t(og_eq(v_layout, 'single')) ? 'xl' : 'base')), 'children': c_7}, with_context = false) }}
{%- set c_11 -%}
{%- if og_t(not (og_eq(og_get(v_item, ['avatar']), 'none'))) %}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_q, ['author']), 'src': og_get(v_q, ['image']), 'ratio': '1/1', 'className': og_cnv(['size-12 shrink-0 rounded-full'])}}, with_context = false) }}
{%- endif %}
{%- set c_10 -%}
{%- set c_8 -%}
{{ og_text(og_get(v_q, ['author'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_8}, with_context = false) }}
{%- set c_9 -%}
{{ og_text(og_tpl(og_get(v_labels, ['byLine']), [og_get(v_q, ['role']), og_get(v_q, ['company'])])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_9}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '0', 'children': c_10}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'children': c_11}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/figure-block.html.twig', {'p': {'className': og_cnv([og_cnv(['m-0 flex flex-col gap-4', (og_t(og_eq(og_get(v_item, ['kind']), 'plain')) ? '' : 'rounded p-6 inset-ring inset-ring-border bg-card'), (og_t(og_eq(v_layout, 'masonry')) ? 'mb-4 break-inside-avoid' : (og_t(og_eq(v_layout, 'strip')) ? 'w-80 shrink-0 snap-start' : 'h-full'))])]), 'testid': 'item'}, 'children': og_markup(c_12)}, 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 quote-card{* 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/quote-card.json
One customer quote of TestimonialGrid: a card, a plain figure or a social post, with the author's picture, the stars and a company glyph as `item` says.
Props (p): q, labels, item, layout. *}
{var $v_q = ($p['q'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_item = ($p['item'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'grid')}
{capture $c_12}
{if og_t(og_eq(og_get($v_item, ['kind']), 'social'))}
{capture $c_4}
{if og_t(!(og_eq(og_get($v_item, ['avatar']), 'none')))}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_q, ['author']), 'src' => og_get($v_q, ['image']), 'ratio' => '1/1', 'className' => og_cnv(['size-12 shrink-0 rounded-full'])]])|noescape}
{/if}
{capture $c_3}
{capture $c_1}
{=og_text(og_get($v_q, ['author']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
{capture $c_2}
{=og_text(og_tpl(og_get($v_labels, ['handleLine']), [og_get($v_q, ['handle']), og_get($v_q, ['time'])]))}
{/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}
{=og_include('icons/LucideIcon.latte', ['name' => 'message-circle', 'size' => 16, 'class' => 'ml-auto text-muted-foreground'])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'children' => (string) $c_4])|noescape}
{capture $c_5}
{=og_text(og_get($v_q, ['quote']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'base', 'children' => (string) $c_5])|noescape}
{else}
{if og_t(!(og_eq(og_get($v_item, ['rating']), 'hide')))}
{=og_include('blocks/rating.latte', ['p' => ['value' => og_get($v_q, ['rating']), 'label' => og_tpl(og_get($v_labels, ['rating']), [og_get($v_q, ['rating'])])]])|noescape}
{/if}
{if og_t(og_eq(og_get($v_item, ['mark']), 'icon'))}
{capture $c_6}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_q, ['mark'])), 'size' => 24])|noescape}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-muted-foreground', 'attrs' => og_attrs(['data-slot', 'mark']), 'children' => (string) $c_6])|noescape}
{/if}
{capture $c_7}
{=og_text(og_get($v_q, ['quote']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => og_s((og_t(og_eq($v_layout, 'single')) ? 'xl' : 'base')), 'children' => (string) $c_7])|noescape}
{capture $c_11}
{if og_t(!(og_eq(og_get($v_item, ['avatar']), 'none')))}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_q, ['author']), 'src' => og_get($v_q, ['image']), 'ratio' => '1/1', 'className' => og_cnv(['size-12 shrink-0 rounded-full'])]])|noescape}
{/if}
{capture $c_10}
{capture $c_8}
{=og_text(og_get($v_q, ['author']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_8])|noescape}
{capture $c_9}
{=og_text(og_tpl(og_get($v_labels, ['byLine']), [og_get($v_q, ['role']), og_get($v_q, ['company'])]))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_9])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '0', 'children' => (string) $c_10])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'children' => (string) $c_11])|noescape}
{/if}
{/capture}
{=og_include('blocks/figure-block.latte', ['p' => ['className' => og_cnv([og_cnv(['m-0 flex flex-col gap-4', (og_t(og_eq(og_get($v_item, ['kind']), 'plain')) ? '' : 'rounded p-6 inset-ring inset-ring-border bg-card'), (og_t(og_eq($v_layout, 'masonry')) ? 'mb-4 break-inside-avoid' : (og_t(og_eq($v_layout, 'strip')) ? 'w-80 shrink-0 snap-start' : 'h-full'))])]), 'testid' => 'item'], 'children' => og_markup($c_12)])|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 quote-card{#- 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/quote-card.json
One customer quote of TestimonialGrid: a card, a plain figure or a social post, with the author's picture, the stars and a company glyph as `item` says.
Props (p): q, labels, item, layout. -#}
{%- set v_q = og_def(p['q'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_item = og_def(p['item'], none) -%}
{%- set v_layout = og_def(p['layout'], 'grid') -%}
{%- set c_12 -%}
{%- if og_t(og_eq(og_get(v_item, ['kind']), 'social')) %}
{%- set c_4 -%}
{%- if og_t(not (og_eq(og_get(v_item, ['avatar']), 'none'))) %}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_q, ['author']), 'src': og_get(v_q, ['image']), 'ratio': '1/1', 'className': og_cnv(['size-12 shrink-0 rounded-full'])}}) }}
{%- endif %}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_q, ['author'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_1}) }}
{%- set c_2 -%}
{{ og_text(og_tpl(og_get(v_labels, ['handleLine']), [og_get(v_q, ['handle']), og_get(v_q, ['time'])])) }}
{%- 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}) }}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'message-circle', 'Size': 16, 'Class': 'ml-auto text-muted-foreground'}}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center'}, 'children': c_4}) }}
{%- set c_5 -%}
{{ og_text(og_get(v_q, ['quote'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'base'}, 'children': c_5}) }}
{%- else %}
{%- if og_t(not (og_eq(og_get(v_item, ['rating']), 'hide'))) %}
{{ og_include('blocks/rating.html.j2', {'p': {'value': og_get(v_q, ['rating']), 'label': og_tpl(og_get(v_labels, ['rating']), [og_get(v_q, ['rating'])])}}) }}
{%- endif %}
{%- if og_t(og_eq(og_get(v_item, ['mark']), 'icon')) %}
{%- set c_6 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_q, ['mark'])), 'Size': 24}}) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-muted-foreground', 'Attrs': og_attrs(['data-slot', 'mark'])}, 'children': c_6}) }}
{%- endif %}
{%- set c_7 -%}
{{ og_text(og_get(v_q, ['quote'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': og_s(('xl' if og_t(og_eq(v_layout, 'single')) else 'base'))}, 'children': c_7}) }}
{%- set c_11 -%}
{%- if og_t(not (og_eq(og_get(v_item, ['avatar']), 'none'))) %}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_q, ['author']), 'src': og_get(v_q, ['image']), 'ratio': '1/1', 'className': og_cnv(['size-12 shrink-0 rounded-full'])}}) }}
{%- endif %}
{%- set c_10 -%}
{%- set c_8 -%}
{{ og_text(og_get(v_q, ['author'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_8}) }}
{%- set c_9 -%}
{{ og_text(og_tpl(og_get(v_labels, ['byLine']), [og_get(v_q, ['role']), og_get(v_q, ['company'])])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_9}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '0'}, 'children': c_10}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center'}, 'children': c_11}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/figure-block.html.j2', {'p': {'className': og_cnv([og_cnv(['m-0 flex flex-col gap-4', ('' if og_t(og_eq(og_get(v_item, ['kind']), 'plain')) else 'rounded p-6 inset-ring inset-ring-border bg-card'), ('mb-4 break-inside-avoid' if og_t(og_eq(v_layout, 'masonry')) else ('w-80 shrink-0 snap-start' if og_t(og_eq(v_layout, 'strip')) else 'h-full'))])]), 'testid': 'item'}, 'children': og_markup(c_12)}) }}
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.
One customer quote of TestimonialGrid: a card, a plain figure or a social post, with the author's picture, the stars and a company glyph as `item` says.
| Prop | Type | Default | Description |
|---|---|---|---|
| q (required) | Quote | - | |
| labels (required) | QuoteLabels | - | the templates of the lines around the quote |
| item | QuoteItem | - | how the quote is drawn |
| layout | "grid" | "single" | "stack" | "masonry" | "strip" | "grid" | the layout of the grid around it: the size of the card |