Product Info
Texts in an accordion beside a card of specs.
Install
npx ui8kit add product-infoPulls in: box, compose, disclosure, inline, kit-box, kit-disclosure, kit-text, list, list-item, section-frame, stack, summary, text, title, utils
Preview
Product details
Description
A desk lamp with a long reach and a heavy base. The arm moves in three joints and stays where you leave it.
Materials
Powder-coated aluminium arm, steel base, linen-wrapped cable.
Care
Wipe with a dry cloth. The LED module lasts about 25,000 hours and can be replaced.
Shipping and returns
Ships within one working day. Thirty days to return it in the original box.
Specifications
- CategoryLighting
- Weight1.2 kg
- Size42 x 18 cm
- MaterialAluminium
- Warranty2 years
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 product-info<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
The details of a product under its buy box: texts in an accordion (native details) beside a card with the
specs. Axes: layout (split: the specs beside the texts, stacked: below them), expand (first: the first text
open, none), tone.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Detail, Spec, ProductInfoLabels } from "./product-info.types";
export type ProductInfoProps = {
id: string;
title: string;
details: Detail[];
specs: Spec[];
labels: ProductInfoLabels;
layout?: "split" | "stacked";
expand?: "first" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Disclosure from "../compose/Disclosure.svelte";
import Inline from "../compose/Inline.svelte";
import List from "../compose/List.svelte";
import ListItem from "../compose/ListItem.svelte";
import Stack from "../compose/Stack.svelte";
import Summary from "../compose/Summary.svelte";
import Text from "../compose/Text.svelte";
import Title from "../compose/Title.svelte";
import SectionFrame from "../components/section-frame.svelte";
let {
id,
title,
details,
specs,
labels,
layout = "split",
expand = "first",
tone = "default",
landmarkLabel,
}: ProductInfoProps = $props();
</script>
<SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
<Box
class={
(layout as string) === "split" ? "grid grid-cols-1 items-start gap-8 lg:grid-cols-3"
: "grid grid-cols-1 gap-8"
}
>
{#if ((details?.length ?? 0) > 0)}
<Stack
gap="0"
align="stretch"
class={(((layout as string) === "split") ? "lg:col-span-2" : "")}
data-slot="items"
>
{#each details as d, i (d.id)}
<Disclosure variant="item" open={(((expand as string) === "first") && (i === 0))} data-slot="item">
<Summary variant="item">
<Inline class="text-base font-semibold">
{d.title}
</Inline>
</Summary>
<Text size="sm" class="pb-4 text-muted-foreground">
{d.text}
</Text>
</Disclosure>
{/each}
</Stack>
{/if}
{#if ((specs?.length ?? 0) > 0)}
<Stack gap="4" align="stretch" class="rounded bg-card inset-ring inset-ring-border p-6" data-slot="specs">
<Title as={3} size="lg" weight="bold">
{labels.specs}
</Title>
<List tag="ul" class="flex flex-col">
{#each specs as s (s.id)}
<ListItem
class="flex items-center justify-between gap-4 border-b border-border py-2 text-sm last:border-b-0"
data-slot="spec"
>
<Inline class="text-muted-foreground">
{s.label}
</Inline>
<Inline class="font-medium">
{s.value}
</Inline>
</ListItem>
{/each}
</List>
</Stack>
{/if}
</Box>
</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 Detail = {
id: string;
title: string;
text: string;
};
export type Spec = {
id: string;
label: string;
value: string;
};
export type ProductInfoLabels = {
specs: string;
};
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 product-info// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* The details of a product under its buy box: texts in an accordion (native details) beside a card with the
* specs. Axes: layout (split: the specs beside the texts, stacked: below them), expand (first: the first text
* open, none), tone.
*/
import { type ReactNode } from "react";
import { Box, Disclosure, Inline, List, ListItem, Stack, Summary, Text, Title } from "../compose";
import { SectionFrame } from "../components/section-frame";
import type { Detail, Spec, ProductInfoLabels } from "./product-info.types";
export type ProductInfoProps = {
id: string;
title: string;
details: Detail[];
specs: Spec[];
labels: ProductInfoLabels;
layout?: "split" | "stacked";
expand?: "first" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function ProductInfo({
id,
title,
details,
specs,
labels,
layout = "split",
expand = "first",
tone = "default",
landmarkLabel,
}: ProductInfoProps) {
return (
<SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
<Box
className={
(layout as string) === "split" ? "grid grid-cols-1 items-start gap-8 lg:grid-cols-3"
: "grid grid-cols-1 gap-8"
}
>
{((details?.length ?? 0) > 0) ? (
<Stack
gap="0"
align="stretch"
className={(((layout as string) === "split") ? "lg:col-span-2" : "")}
data-slot="items"
>
{(details ?? []).map((d, i) => (
<Disclosure key={d.id} variant="item" open={(((expand as string) === "first") && (i === 0))} data-slot="item">
<Summary variant="item">
<Inline className="text-base font-semibold">
{d.title}
</Inline>
</Summary>
<Text size="sm" className="pb-4 text-muted-foreground">
{d.text}
</Text>
</Disclosure>
))}
</Stack>
) : null}
{((specs?.length ?? 0) > 0) ? (
<Stack gap="4" align="stretch" className="rounded bg-card inset-ring inset-ring-border p-6" data-slot="specs">
<Title as={3} size="lg" weight="bold">
{labels.specs}
</Title>
<List tag="ul" className="flex flex-col">
{(specs ?? []).map((s) => (
<ListItem key={s.id}
className={"flex items-center justify-between gap-4 border-b border-border py-2 text-sm last:border-b-0"}
data-slot="spec"
>
<Inline className="text-muted-foreground">
{s.label}
</Inline>
<Inline className="font-medium">
{s.value}
</Inline>
</ListItem>
))}
</List>
</Stack>
) : null}
</Box>
</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 Detail = {
id: string;
title: string;
text: string;
};
export type Spec = {
id: string;
label: string;
value: string;
};
export type ProductInfoLabels = {
specs: string;
};
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 product-info// 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 Detail = {
id: string;
title: string;
text: string;
};
export type Spec = {
id: string;
label: string;
value: string;
};
export type ProductInfoLabels = {
specs: string;
};
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
The details of a product under its buy box: texts in an accordion (native details) beside a card with the
specs. Axes: layout (split: the specs beside the texts, stacked: below them), expand (first: the first text
open, none), tone.
-->
<script lang="ts">
import type { Detail, Spec, ProductInfoLabels } from "./product-info.types";
export type ProductInfoProps = {
id: string;
title: string;
details: Detail[];
specs: Spec[];
labels: ProductInfoLabels;
layout?: "split" | "stacked";
expand?: "first" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import Disclosure from "../compose/Disclosure.vue";
import Inline from "../compose/Inline.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import Stack from "../compose/Stack.vue";
import Summary from "../compose/Summary.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import SectionFrame from "../components/section-frame.vue";
const {
id,
title,
details,
specs,
labels,
layout = "split",
expand = "first",
tone = "default",
landmarkLabel,
} = defineProps<ProductInfoProps>();
</script>
<template>
<SectionFrame :id="id" :title="title" :tone="tone" :landmarkLabel="landmarkLabel">
<Box
:class="
(layout as string) === 'split' ? 'grid grid-cols-1 items-start gap-8 lg:grid-cols-3'
: 'grid grid-cols-1 gap-8'
"
>
<Stack v-if="((details?.length ?? 0) > 0)"
gap="0"
align="stretch"
:class="(((layout as string) === 'split') ? 'lg:col-span-2' : '')"
data-slot="items"
>
<Disclosure
v-for="(d, i) in details"
:key="d.id"
variant="item"
:open="(((expand as string) === 'first') && (i === 0))"
data-slot="item"
>
<Summary variant="item">
<Inline class="text-base font-semibold">
{{ d.title }}
</Inline>
</Summary>
<Text size="sm" class="pb-4 text-muted-foreground">
{{ d.text }}
</Text>
</Disclosure>
</Stack>
<Stack
v-if="((specs?.length ?? 0) > 0)"
gap="4"
align="stretch"
class="rounded bg-card inset-ring inset-ring-border p-6"
data-slot="specs"
>
<Title :as="3" size="lg" weight="bold">
{{ labels.specs }}
</Title>
<List tag="ul" class="flex flex-col">
<ListItem v-for="s in specs" :key="s.id"
class="flex items-center justify-between gap-4 border-b border-border py-2 text-sm last:border-b-0"
data-slot="spec"
>
<Inline class="text-muted-foreground">
{{ s.label }}
</Inline>
<Inline class="font-medium">
{{ s.value }}
</Inline>
</ListItem>
</List>
</Stack>
</Box>
</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 product-info// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* The details of a product under its buy box: texts in an accordion (native details) beside a card with the
* specs. Axes: layout (split: the specs beside the texts, stacked: below them), expand (first: the first text
* open, none), tone.
*/
import { For, type JSX } from "solid-js";
import { Box, Disclosure, Inline, List, ListItem, Stack, Summary, Text, Title } from "../compose";
import { SectionFrame } from "../components/section-frame";
import type { Detail, Spec, ProductInfoLabels } from "./product-info.types";
export type ProductInfoProps = {
id: string;
title: string;
details: Detail[];
specs: Spec[];
labels: ProductInfoLabels;
layout?: "split" | "stacked";
expand?: "first" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function ProductInfo({
id,
title,
details,
specs,
labels,
layout = "split",
expand = "first",
tone = "default",
landmarkLabel,
}: ProductInfoProps) {
return (
<SectionFrame id={id} title={title} tone={tone} landmarkLabel={landmarkLabel}>
<Box
class={
(layout as string) === "split" ? "grid grid-cols-1 items-start gap-8 lg:grid-cols-3"
: "grid grid-cols-1 gap-8"
}
>
{((details?.length ?? 0) > 0) ? (
<Stack
gap="0"
align="stretch"
class={(((layout as string) === "split") ? "lg:col-span-2" : "")}
data-slot="items"
>
<For each={details ?? []}>{(d, iOf) => { const i = iOf(); return (
<Disclosure variant="item" open={(((expand as string) === "first") && (i === 0))} data-slot="item">
<Summary variant="item">
<Inline class="text-base font-semibold">
{d.title}
</Inline>
</Summary>
<Text size="sm" class="pb-4 text-muted-foreground">
{d.text}
</Text>
</Disclosure>
); }}</For>
</Stack>
) : null}
{((specs?.length ?? 0) > 0) ? (
<Stack gap="4" align="stretch" class="rounded bg-card inset-ring inset-ring-border p-6" data-slot="specs">
<Title as={3} size="lg" weight="bold">
{labels.specs}
</Title>
<List tag="ul" class="flex flex-col">
<For each={specs ?? []}>{(s) => (
<ListItem
class="flex items-center justify-between gap-4 border-b border-border py-2 text-sm last:border-b-0"
data-slot="spec"
>
<Inline class="text-muted-foreground">
{s.label}
</Inline>
<Inline class="font-medium">
{s.value}
</Inline>
</ListItem>
)}</For>
</List>
</Stack>
) : null}
</Box>
</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 Detail = {
id: string;
title: string;
text: string;
};
export type Spec = {
id: string;
label: string;
value: string;
};
export type ProductInfoLabels = {
specs: string;
};
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 product-info// 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/product-info.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/disclosure"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// ProductInfoProps are the props of ProductInfo; the values are the JSON shapes of the TypeScript props.
type ProductInfoProps struct {
Id any `json:"id"`
Title any `json:"title"`
Details any `json:"details"`
Specs any `json:"specs"`
Labels any `json:"labels"`
Layout any `json:"layout"`
Expand any `json:"expand"`
Tone any `json:"tone"`
LandmarkLabel any `json:"landmarkLabel"`
}
// The details of a product under its buy box: texts in an accordion (native details) beside a card with the specs. Axes: layout (split: the specs beside the texts, stacked: below them), expand (first: the first text open, none), tone.
templ ProductInfo(p ProductInfoProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vDetails := p.Details }}
{{ vSpecs := p.Specs }}
{{ vLabels := p.Labels }}
{{ vLayout := uiutils.Def(p.Layout, "split") }}
{{ vExpand := uiutils.Def(p.Expand, "first") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, LandmarkLabel: vLandmarkLabel}) {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "split")), "grid grid-cols-1 items-start gap-8 lg:grid-cols-3", "grid grid-cols-1 gap-8"))}}) {
if uiutils.Gt(uiutils.Len(vDetails), float64(0)) {
@compose.Stack(compose.StackProps{Gap: "0", Align: "stretch", BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "split")), "lg:col-span-2", "")), Attrs: uiutils.Attrs("data-slot", "items")}}) {
for vI, vD := range uiutils.L(vDetails) {
@compose.Disclosure(compose.DisclosureProps{Variant: "item", DisclosureProps: disclosure.DisclosureProps{Open: uiutils.T(uiutils.And(uiutils.Eq(vExpand, "first"), uiutils.Eq(float64(vI), float64(0)))), Attrs: uiutils.Attrs("data-slot", "item")}}) {
@compose.Summary(compose.SummaryProps{Variant: "item", SummaryProps: disclosure.SummaryProps{}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-base font-semibold"}}) {
{ uiutils.Text(uiutils.Get(vD, "title")) }
}
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "pb-4 text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vD, "text")) }
}
}
}
}
}
if uiutils.Gt(uiutils.Len(vSpecs), float64(0)) {
@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{Class: "rounded bg-card inset-ring inset-ring-border p-6", Attrs: uiutils.Attrs("data-slot", "specs")}}) {
@compose.Title(compose.TitleProps{As: "3", Size: "lg", Weight: "bold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vLabels, "specs")) }
}
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ul", Class: "flex flex-col"}}) {
for _, vS := range uiutils.L(vSpecs) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex items-center justify-between gap-4 border-b border-border py-2 text-sm last:border-b-0", Attrs: uiutils.Attrs("data-slot", "spec")}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vS, "label")) }
}
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "font-medium"}}) {
{ uiutils.Text(uiutils.Get(vS, "value")) }
}
}
}
}
}
}
}
}
}
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 product-info{#- 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/product-info.json
The details of a product under its buy box: texts in an accordion (native details) beside a card with the specs. Axes: layout (split: the specs beside the texts, stacked: below them), expand (first: the first text open, none), tone.
Props (p): id, title, details, specs, labels, layout, expand, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_details = (p.details ?? null) -%}
{%- set v_specs = (p.specs ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_layout = (p.layout ?? 'split') -%}
{%- set v_expand = (p.expand ?? 'first') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_13 -%}
{%- set c_12 -%}
{%- if og_t(og_gt(og_len(v_details), 0)) %}
{%- set c_5 -%}
{%- for v_d in og_l(v_details) %}
{%- set v_i = loop.index0 -%}
{%- set c_4 -%}
{%- set c_2 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_d, ['title'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-base font-semibold', 'children': c_1}, with_context = false) }}
{%- endset -%}
{{ include('compose/Summary.html.twig', {'variant': 'item', 'children': c_2}, with_context = false) }}
{%- set c_3 -%}
{{ og_text(og_get(v_d, ['text'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'pb-4 text-muted-foreground', 'children': c_3}, with_context = false) }}
{%- endset -%}
{{ include('compose/Disclosure.html.twig', {'variant': 'item', 'open': og_t(og_and([og_eq(v_expand, 'first'), og_eq(v_i, 0)])), 'attrs': og_attrs(['data-slot', 'item']), 'children': c_4}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '0', 'align': 'stretch', 'class': og_s((og_t(og_eq(v_layout, 'split')) ? 'lg:col-span-2' : '')), 'attrs': og_attrs(['data-slot', 'items']), 'children': c_5}, with_context = false) }}
{%- endif %}
{%- if og_t(og_gt(og_len(v_specs), 0)) %}
{%- set c_11 -%}
{%- set c_6 -%}
{{ og_text(og_get(v_labels, ['specs'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'lg', 'weight': 'bold', 'children': c_6}, with_context = false) }}
{%- set c_10 -%}
{%- for v_s in og_l(v_specs) %}
{%- set c_9 -%}
{%- set c_7 -%}
{{ og_text(og_get(v_s, ['label'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-muted-foreground', 'children': c_7}, with_context = false) }}
{%- set c_8 -%}
{{ og_text(og_get(v_s, ['value'])) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'font-medium', 'children': c_8}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'class': 'flex items-center justify-between gap-4 border-b border-border py-2 text-sm last:border-b-0', 'attrs': og_attrs(['data-slot', 'spec']), 'children': c_9}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/List.html.twig', {'tag': 'ul', 'class': 'flex flex-col', 'children': c_10}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'class': 'rounded bg-card inset-ring inset-ring-border p-6', 'attrs': og_attrs(['data-slot', 'specs']), 'children': c_11}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s((og_t(og_eq(v_layout, 'split')) ? 'grid grid-cols-1 items-start gap-8 lg:grid-cols-3' : 'grid grid-cols-1 gap-8')), 'children': c_12}, with_context = false) }}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_13)}, with_context = false) }}
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 product-info{* 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/product-info.json
The details of a product under its buy box: texts in an accordion (native details) beside a card with the specs. Axes: layout (split: the specs beside the texts, stacked: below them), expand (first: the first text open, none), tone.
Props (p): id, title, details, specs, labels, layout, expand, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_details = ($p['details'] ?? null)}
{var $v_specs = ($p['specs'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'split')}
{var $v_expand = ($p['expand'] ?? 'first')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_13}
{capture $c_12}
{if og_t(og_gt(og_len($v_details), 0))}
{capture $c_5}
{foreach og_l($v_details) as $v_d}
{var $v_i = $iterator->counter0}
{capture $c_4}
{capture $c_2}
{capture $c_1}
{=og_text(og_get($v_d, ['title']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-base font-semibold', 'children' => (string) $c_1])|noescape}
{/capture}
{=og_include('compose/Summary.latte', ['variant' => 'item', 'children' => (string) $c_2])|noescape}
{capture $c_3}
{=og_text(og_get($v_d, ['text']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'pb-4 text-muted-foreground', 'children' => (string) $c_3])|noescape}
{/capture}
{=og_include('compose/Disclosure.latte', ['variant' => 'item', 'open' => og_t(og_and([og_eq($v_expand, 'first'), og_eq($v_i, 0)])), 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_4])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '0', 'align' => 'stretch', 'class' => og_s((og_t(og_eq($v_layout, 'split')) ? 'lg:col-span-2' : '')), 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_5])|noescape}
{/if}
{if og_t(og_gt(og_len($v_specs), 0))}
{capture $c_11}
{capture $c_6}
{=og_text(og_get($v_labels, ['specs']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'lg', 'weight' => 'bold', 'children' => (string) $c_6])|noescape}
{capture $c_10}
{foreach og_l($v_specs) as $v_s}
{capture $c_9}
{capture $c_7}
{=og_text(og_get($v_s, ['label']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-muted-foreground', 'children' => (string) $c_7])|noescape}
{capture $c_8}
{=og_text(og_get($v_s, ['value']))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'font-medium', 'children' => (string) $c_8])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['class' => 'flex items-center justify-between gap-4 border-b border-border py-2 text-sm last:border-b-0', 'attrs' => og_attrs(['data-slot', 'spec']), 'children' => (string) $c_9])|noescape}
{/foreach}
{/capture}
{=og_include('compose/List.latte', ['tag' => 'ul', 'class' => 'flex flex-col', 'children' => (string) $c_10])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'class' => 'rounded bg-card inset-ring inset-ring-border p-6', 'attrs' => og_attrs(['data-slot', 'specs']), 'children' => (string) $c_11])|noescape}
{/if}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s((og_t(og_eq($v_layout, 'split')) ? 'grid grid-cols-1 items-start gap-8 lg:grid-cols-3' : 'grid grid-cols-1 gap-8')), 'children' => (string) $c_12])|noescape}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_13)])|noescape}
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 product-info{#- 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/product-info.json
The details of a product under its buy box: texts in an accordion (native details) beside a card with the specs. Axes: layout (split: the specs beside the texts, stacked: below them), expand (first: the first text open, none), tone.
Props (p): id, title, details, specs, labels, layout, expand, tone, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_details = og_def(p['details'], none) -%}
{%- set v_specs = og_def(p['specs'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'split') -%}
{%- set v_expand = og_def(p['expand'], 'first') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_13 -%}
{%- set c_12 -%}
{%- if og_t(og_gt(og_len(v_details), 0)) %}
{%- set c_5 -%}
{%- for v_d in og_l(v_details) %}
{%- set v_i = loop.index0 -%}
{%- set c_4 -%}
{%- set c_2 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_d, ['title'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-base font-semibold'}, 'children': c_1}) }}
{%- endset -%}
{{ og_include('compose/summary.html.j2', {'p': {'Variant': 'item'}, 'children': c_2}) }}
{%- set c_3 -%}
{{ og_text(og_get(v_d, ['text'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'pb-4 text-muted-foreground'}, 'children': c_3}) }}
{%- endset -%}
{{ og_include('compose/disclosure.html.j2', {'p': {'Variant': 'item', 'Open': og_t(og_and([og_eq(v_expand, 'first'), og_eq(v_i, 0)])), 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_4}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '0', 'Align': 'stretch', 'Class': og_s(('lg:col-span-2' if og_t(og_eq(v_layout, 'split')) else '')), 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_5}) }}
{%- endif %}
{%- if og_t(og_gt(og_len(v_specs), 0)) %}
{%- set c_11 -%}
{%- set c_6 -%}
{{ og_text(og_get(v_labels, ['specs'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'lg', 'Weight': 'bold'}, 'children': c_6}) }}
{%- set c_10 -%}
{%- for v_s in og_l(v_specs) %}
{%- set c_9 -%}
{%- set c_7 -%}
{{ og_text(og_get(v_s, ['label'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-muted-foreground'}, 'children': c_7}) }}
{%- set c_8 -%}
{{ og_text(og_get(v_s, ['value'])) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'font-medium'}, 'children': c_8}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex items-center justify-between gap-4 border-b border-border py-2 text-sm last:border-b-0', 'Attrs': og_attrs(['data-slot', 'spec'])}, 'children': c_9}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Tag': 'ul', 'Class': 'flex flex-col'}, 'children': c_10}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch', 'Class': 'rounded bg-card inset-ring inset-ring-border p-6', 'Attrs': og_attrs(['data-slot', 'specs'])}, 'children': c_11}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(('grid grid-cols-1 items-start gap-8 lg:grid-cols-3' if og_t(og_eq(v_layout, 'split')) else 'grid grid-cols-1 gap-8'))}, 'children': c_12}) }}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_13)}) }}
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.
The details of a product under its buy box: texts in an accordion (native details) beside a card with the specs. Axes: layout (split: the specs beside the texts, stacked: below them), expand (first: the first text open, none), tone.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| details (required) | Detail[] | - | |
| specs (required) | Spec[] | - | |
| labels (required) | ProductInfoLabels | - | |
| layout | "split" | "stacked" | "split" | |
| expand | "first" | "none" | "first" | |
| tone | "default" | "muted" | "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 |