Skip to content
ui8kit

component / components

Cart Summary Card

Cart Summary Card component

Install

npx ui8kit add cart-summary-card

Pulls in: badge, button, cart-list, compose, group, inline, input, kit-box, kit-button, kit-input, kit-progress, kit-text, list, list-item, media-frame, order-summary, progress, stack, text, title, utils

Preview

Order summary

3 products

Try:

WELCOME10FREESHIPDESK15

Add $12 more for free express delivery

  • Subtotal$288
  • Shipping$12
  • Tax$24
  • Total$324

Taxes are calculated at checkout.

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 cart-summary-card
components/cart-summary-card.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. -->
<!--
  The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field
  with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Promo, CartSummaryLabels } from "./cart-summary-card.types";
  import type { CartLine } from "../blocks/cart-list.types";
  import type { SummaryRow } from "../blocks/order-summary.types";

  export type CartSummaryCardProps = {
    lines: CartLine[];
    rows: SummaryRow[];
    promos: Promo[];
    labels: CartSummaryLabels;
    items?: "show" | "hide";
    promo?: "show" | "hide";
    field?: string;
    progress?: "show" | "hide";
    value?: number;
  };
</script>

<script lang="ts">
  import Badge from "../compose/Badge.svelte";
  import Button from "../compose/Button.svelte";
  import Group from "../compose/Group.svelte";
  import Inline from "../compose/Inline.svelte";
  import Input from "../compose/Input.svelte";
  import List from "../compose/List.svelte";
  import ListItem from "../compose/ListItem.svelte";
  import Progress from "../compose/Progress.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import Title from "../compose/Title.svelte";
  import MediaFrame from "../components/media-frame.svelte";
  import { cn, fmtMoney, tpl } from "../utils";

  let {
    lines,
    rows,
    promos,
    labels,
    items = "hide",
    promo = "show",
    field = "promo",
    progress = "show",
    value = 70,
  }: CartSummaryCardProps = $props();
</script>

<Stack gap="6" align="stretch" class="rounded bg-card inset-ring inset-ring-border p-6" data-slot="summary">
  <Group gap="4" align="baseline" justify="between">
    <Title as={2} size="lg" weight="semibold">
      {labels.title}
    </Title>
    <Text size="xs" class="text-muted-foreground">
      {tpl(labels.items, ((lines?.length ?? 0) == null ? undefined : String((lines?.length ?? 0))))}
    </Text>
  </Group>
  {#if (((items as string) === "show") && ((lines?.length ?? 0) > 0))}
    <List tag="ul" class="flex flex-col gap-4" data-slot="summary-lines">
      {#each lines as line (line.id)}
        <ListItem class="flex items-center gap-4 text-sm" data-slot="cart-line">
          <MediaFrame alt={line.name} src={line.image} ratio="1/1" class="size-12 shrink-0" />
          <Stack gap="0" class="flex-1">
            <Text size="sm" weight="semibold">
              {line.name}
            </Text>
            <Text size="xs" class="text-muted-foreground">
              {tpl("{0} x {1}", line.qty, fmtMoney(line.price, line.currency))}
            </Text>
          </Stack>
          <Inline class="font-medium">
            {fmtMoney((line.price * line.qty), line.currency)}
          </Inline>
        </ListItem>
      {/each}
    </List>
  {/if}
  {#if ((promo as string) === "show")}
    <Stack gap="2" align="stretch" data-slot="promo">
      <Group gap="2" align="center">
        <Input type="text" name={field} aria-label={labels.promo} placeholder={labels.promo} class="min-w-0 flex-1" />
        <Button variant="outline" size="default" type="button">
          {labels.apply}
        </Button>
      </Group>
      {#if ((promos?.length ?? 0) > 0)}
        <Group gap="2" align="center" class="flex-wrap">
          <Text size="xs" class="text-muted-foreground">
            {labels.codes}
          </Text>
          {#each promos as c (c.id)}
            <Badge variant="outline" size="sm">
              {c.code}
            </Badge>
          {/each}
        </Group>
      {/if}
    </Stack>
  {/if}
  {#if ((progress as string) === "show")}
    <Stack gap="2" align="stretch" class="rounded bg-muted p-4" data-slot="progress">
      <Text size="sm">
        {labels.progress}
      </Text>
      <Progress value={(value == null ? undefined : String(value))} max="100" aria-label={labels.progress} />
    </Stack>
  {/if}
  {#if ((rows?.length ?? 0) > 0)}
    <List tag="ul" class="flex flex-col gap-2">
      {#each rows as row (row.id)}
        <ListItem
          class={cn(
            "flex items-center justify-between gap-4",
            (
              row.strong ? "border-t border-border pt-4 text-base font-bold"
              : "text-sm text-muted-foreground"
            )
          )}
          data-slot="row"
        >
          <Inline>
            {row.label}
          </Inline>
          <Inline>
            {fmtMoney(row.amount, row.currency)}
          </Inline>
        </ListItem>
      {/each}
    </List>
  {/if}
  <Button variant="default" size="lg" class="w-full">
    {labels.checkout}
  </Button>
  <Text size="xs" class="text-muted-foreground">
    {labels.note}
  </Text>
</Stack>
components/cart-summary-card.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 Promo = {
  id: string;
  code: string;
};

export type CartSummaryLabels = {
  title: string;
  items: string;
  promo: string;
  apply: string;
  codes: string;
  progress: string;
  checkout: string;
  note: 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 cart-summary-card
components/cart-summary-card.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.
/**
 * The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field
 * with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.
 */
import { type ReactNode } from "react";
import { Badge, Button, Group, Inline, Input, List, ListItem, Progress, Stack, Text, Title } from "../compose";
import { MediaFrame } from "../components/media-frame";
import { cn, fmtMoney, tpl } from "../utils";
import type { Promo, CartSummaryLabels } from "./cart-summary-card.types";
import type { CartLine } from "../blocks/cart-list.types";
import type { SummaryRow } from "../blocks/order-summary.types";

export type CartSummaryCardProps = {
  lines: CartLine[];
  rows: SummaryRow[];
  promos: Promo[];
  labels: CartSummaryLabels;
  items?: "show" | "hide";
  promo?: "show" | "hide";
  field?: string;
  progress?: "show" | "hide";
  value?: number;
};

export function CartSummaryCard({
  lines,
  rows,
  promos,
  labels,
  items = "hide",
  promo = "show",
  field = "promo",
  progress = "show",
  value = 70,
}: CartSummaryCardProps) {
  return (
    <Stack gap="6" align="stretch" className="rounded bg-card inset-ring inset-ring-border p-6" data-slot="summary">
      <Group gap="4" align="baseline" justify="between">
        <Title as={2} size="lg" weight="semibold">
          {labels.title}
        </Title>
        <Text size="xs" className="text-muted-foreground">
          {tpl(labels.items, ((lines?.length ?? 0) == null ? undefined : String((lines?.length ?? 0))))}
        </Text>
      </Group>
      {(((items as string) === "show") && ((lines?.length ?? 0) > 0)) ? (
        <List tag="ul" className="flex flex-col gap-4" data-slot="summary-lines">
          {(lines ?? []).map((line) => (
            <ListItem key={line.id} className="flex items-center gap-4 text-sm" data-slot="cart-line">
              <MediaFrame alt={line.name} src={line.image} ratio="1/1" className="size-12 shrink-0" />
              <Stack gap="0" className="flex-1">
                <Text size="sm" weight="semibold">
                  {line.name}
                </Text>
                <Text size="xs" className="text-muted-foreground">
                  {tpl("{0} x {1}", line.qty, fmtMoney(line.price, line.currency))}
                </Text>
              </Stack>
              <Inline className="font-medium">
                {fmtMoney((line.price * line.qty), line.currency)}
              </Inline>
            </ListItem>
          ))}
        </List>
      ) : null}
      {((promo as string) === "show") ? (
        <Stack gap="2" align="stretch" data-slot="promo">
          <Group gap="2" align="center">
            <Input type="text" name={field} aria-label={labels.promo} placeholder={labels.promo} className="min-w-0 flex-1" />
            <Button variant="outline" size="default" type="button">
              {labels.apply}
            </Button>
          </Group>
          {((promos?.length ?? 0) > 0) ? (
            <Group gap="2" align="center" className="flex-wrap">
              <Text size="xs" className="text-muted-foreground">
                {labels.codes}
              </Text>
              {(promos ?? []).map((c) => (
                <Badge key={c.id} variant="outline" size="sm">
                  {c.code}
                </Badge>
              ))}
            </Group>
          ) : null}
        </Stack>
      ) : null}
      {((progress as string) === "show") ? (
        <Stack gap="2" align="stretch" className="rounded bg-muted p-4" data-slot="progress">
          <Text size="sm">
            {labels.progress}
          </Text>
          <Progress value={(value == null ? undefined : String(value))} max="100" aria-label={labels.progress} />
        </Stack>
      ) : null}
      {((rows?.length ?? 0) > 0) ? (
        <List tag="ul" className="flex flex-col gap-2">
          {(rows ?? []).map((row) => (
            <ListItem key={row.id}
              className={cn(
                "flex items-center justify-between gap-4",
                (
                  row.strong ? "border-t border-border pt-4 text-base font-bold"
                  : "text-sm text-muted-foreground"
                )
              )}
              data-slot="row"
            >
              <Inline>
                {row.label}
              </Inline>
              <Inline>
                {fmtMoney(row.amount, row.currency)}
              </Inline>
            </ListItem>
          ))}
        </List>
      ) : null}
      <Button variant="default" size="lg" className="w-full">
        {labels.checkout}
      </Button>
      <Text size="xs" className="text-muted-foreground">
        {labels.note}
      </Text>
    </Stack>
  );
}
components/cart-summary-card.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 Promo = {
  id: string;
  code: string;
};

export type CartSummaryLabels = {
  title: string;
  items: string;
  promo: string;
  apply: string;
  codes: string;
  progress: string;
  checkout: string;
  note: 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 cart-summary-card
components/cart-summary-card.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 Promo = {
  id: string;
  code: string;
};

export type CartSummaryLabels = {
  title: string;
  items: string;
  promo: string;
  apply: string;
  codes: string;
  progress: string;
  checkout: string;
  note: string;
};
components/cart-summary-card.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. -->
<!--
  The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field
  with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.
-->
<script lang="ts">
import type { Promo, CartSummaryLabels } from "./cart-summary-card.types";
import type { CartLine } from "../blocks/cart-list.types";
import type { SummaryRow } from "../blocks/order-summary.types";

export type CartSummaryCardProps = {
  lines: CartLine[];
  rows: SummaryRow[];
  promos: Promo[];
  labels: CartSummaryLabels;
  items?: "show" | "hide";
  promo?: "show" | "hide";
  field?: string;
  progress?: "show" | "hide";
  value?: number;
};
</script>

<script setup lang="ts">
import Badge from "../compose/Badge.vue";
import Button from "../compose/Button.vue";
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import Input from "../compose/Input.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import Progress from "../compose/Progress.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import MediaFrame from "../components/media-frame.vue";
import { cn, fmtMoney, tpl } from "../utils";

const {
  lines,
  rows,
  promos,
  labels,
  items = "hide",
  promo = "show",
  field = "promo",
  progress = "show",
  value = 70,
} = defineProps<CartSummaryCardProps>();
</script>

<template>
  <Stack gap="6" align="stretch" class="rounded bg-card inset-ring inset-ring-border p-6" data-slot="summary">
    <Group gap="4" align="baseline" justify="between">
      <Title :as="2" size="lg" weight="semibold">
        {{ labels.title }}
      </Title>
      <Text size="xs" class="text-muted-foreground">
        {{ tpl(labels.items, ((lines?.length ?? 0) == null ? undefined : String((lines?.length ?? 0)))) }}
      </Text>
    </Group>
    <List
      v-if="(((items as string) === 'show') && ((lines?.length ?? 0) > 0))"
      tag="ul"
      class="flex flex-col gap-4"
      data-slot="summary-lines"
    >
      <ListItem v-for="line in lines" :key="line.id" class="flex items-center gap-4 text-sm" data-slot="cart-line">
        <MediaFrame :alt="line.name" :src="line.image" ratio="1/1" class="size-12 shrink-0" />
        <Stack gap="0" class="flex-1">
          <Text size="sm" weight="semibold">
            {{ line.name }}
          </Text>
          <Text size="xs" class="text-muted-foreground">
            {{ tpl("{0} x {1}", line.qty, fmtMoney(line.price, line.currency)) }}
          </Text>
        </Stack>
        <Inline class="font-medium">
          {{ fmtMoney((line.price * line.qty), line.currency) }}
        </Inline>
      </ListItem>
    </List>
    <Stack v-if="((promo as string) === 'show')" gap="2" align="stretch" data-slot="promo">
      <Group gap="2" align="center">
        <Input type="text" :name="field" :aria-label="labels.promo" :placeholder="labels.promo" class="min-w-0 flex-1" />
        <Button variant="outline" size="default" type="button">
          {{ labels.apply }}
        </Button>
      </Group>
      <Group v-if="((promos?.length ?? 0) > 0)" gap="2" align="center" class="flex-wrap">
        <Text size="xs" class="text-muted-foreground">
          {{ labels.codes }}
        </Text>
        <Badge v-for="c in promos" :key="c.id" variant="outline" size="sm">
          {{ c.code }}
        </Badge>
      </Group>
    </Stack>
    <Stack
      v-if="((progress as string) === 'show')"
      gap="2"
      align="stretch"
      class="rounded bg-muted p-4"
      data-slot="progress"
    >
      <Text size="sm">
        {{ labels.progress }}
      </Text>
      <Progress :value="(value == null ? undefined : String(value))" max="100" :aria-label="labels.progress" />
    </Stack>
    <List v-if="((rows?.length ?? 0) > 0)" tag="ul" class="flex flex-col gap-2">
      <ListItem v-for="row in rows" :key="row.id"
        :class="cn(
          'flex items-center justify-between gap-4',
          (
            row.strong ? 'border-t border-border pt-4 text-base font-bold'
            : 'text-sm text-muted-foreground'
          )
        )"
        data-slot="row"
      >
        <Inline>
          {{ row.label }}
        </Inline>
        <Inline>
          {{ fmtMoney(row.amount, row.currency) }}
        </Inline>
      </ListItem>
    </List>
    <Button variant="default" size="lg" class="w-full">
      {{ labels.checkout }}
    </Button>
    <Text size="xs" class="text-muted-foreground">
      {{ labels.note }}
    </Text>
  </Stack>
</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 cart-summary-card
components/cart-summary-card.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.
/**
 * The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field
 * with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.
 */
import { For, type JSX } from "solid-js";
import { Badge, Button, Group, Inline, Input, List, ListItem, Progress, Stack, Text, Title } from "../compose";
import { MediaFrame } from "../components/media-frame";
import { cn, fmtMoney, tpl } from "../utils";
import type { Promo, CartSummaryLabels } from "./cart-summary-card.types";
import type { CartLine } from "../blocks/cart-list.types";
import type { SummaryRow } from "../blocks/order-summary.types";

export type CartSummaryCardProps = {
  lines: CartLine[];
  rows: SummaryRow[];
  promos: Promo[];
  labels: CartSummaryLabels;
  items?: "show" | "hide";
  promo?: "show" | "hide";
  field?: string;
  progress?: "show" | "hide";
  value?: number;
};

export function CartSummaryCard({
  lines,
  rows,
  promos,
  labels,
  items = "hide",
  promo = "show",
  field = "promo",
  progress = "show",
  value = 70,
}: CartSummaryCardProps) {
  return (
    <Stack gap="6" align="stretch" class="rounded bg-card inset-ring inset-ring-border p-6" data-slot="summary">
      <Group gap="4" align="baseline" justify="between">
        <Title as={2} size="lg" weight="semibold">
          {labels.title}
        </Title>
        <Text size="xs" class="text-muted-foreground">
          {tpl(labels.items, ((lines?.length ?? 0) == null ? undefined : String((lines?.length ?? 0))))}
        </Text>
      </Group>
      {(((items as string) === "show") && ((lines?.length ?? 0) > 0)) ? (
        <List tag="ul" class="flex flex-col gap-4" data-slot="summary-lines">
          <For each={lines ?? []}>{(line) => (
            <ListItem class="flex items-center gap-4 text-sm" data-slot="cart-line">
              <MediaFrame alt={line.name} src={line.image} ratio="1/1" class="size-12 shrink-0" />
              <Stack gap="0" class="flex-1">
                <Text size="sm" weight="semibold">
                  {line.name}
                </Text>
                <Text size="xs" class="text-muted-foreground">
                  {tpl("{0} x {1}", line.qty, fmtMoney(line.price, line.currency))}
                </Text>
              </Stack>
              <Inline class="font-medium">
                {fmtMoney((line.price * line.qty), line.currency)}
              </Inline>
            </ListItem>
          )}</For>
        </List>
      ) : null}
      {((promo as string) === "show") ? (
        <Stack gap="2" align="stretch" data-slot="promo">
          <Group gap="2" align="center">
            <Input type="text" name={field} aria-label={labels.promo} placeholder={labels.promo} class="min-w-0 flex-1" />
            <Button variant="outline" size="default" type="button">
              {labels.apply}
            </Button>
          </Group>
          {((promos?.length ?? 0) > 0) ? (
            <Group gap="2" align="center" class="flex-wrap">
              <Text size="xs" class="text-muted-foreground">
                {labels.codes}
              </Text>
              <For each={promos ?? []}>{(c) => (
                <Badge variant="outline" size="sm">
                  {c.code}
                </Badge>
              )}</For>
            </Group>
          ) : null}
        </Stack>
      ) : null}
      {((progress as string) === "show") ? (
        <Stack gap="2" align="stretch" class="rounded bg-muted p-4" data-slot="progress">
          <Text size="sm">
            {labels.progress}
          </Text>
          <Progress value={(value == null ? undefined : String(value))} max="100" aria-label={labels.progress} />
        </Stack>
      ) : null}
      {((rows?.length ?? 0) > 0) ? (
        <List tag="ul" class="flex flex-col gap-2">
          <For each={rows ?? []}>{(row) => (
            <ListItem
              class={cn(
                "flex items-center justify-between gap-4",
                (
                  row.strong ? "border-t border-border pt-4 text-base font-bold"
                  : "text-sm text-muted-foreground"
                )
              )}
              data-slot="row"
            >
              <Inline>
                {row.label}
              </Inline>
              <Inline>
                {fmtMoney(row.amount, row.currency)}
              </Inline>
            </ListItem>
          )}</For>
        </List>
      ) : null}
      <Button variant="default" size="lg" class="w-full">
        {labels.checkout}
      </Button>
      <Text size="xs" class="text-muted-foreground">
        {labels.note}
      </Text>
    </Stack>
  );
}
components/cart-summary-card.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 Promo = {
  id: string;
  code: string;
};

export type CartSummaryLabels = {
  title: string;
  items: string;
  promo: string;
  apply: string;
  codes: string;
  progress: string;
  checkout: string;
  note: 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 cart-summary-card
blocks/cart-summary-card.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/cart-summary-card.json

package blocks

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

// CartSummaryCardProps are the props of CartSummaryCard; the values are the JSON shapes of the TypeScript props.
type CartSummaryCardProps struct {
	Lines any `json:"lines"`
	Rows any `json:"rows"`
	Promos any `json:"promos"`
	Labels any `json:"labels"`
	Items any `json:"items"`
	Promo any `json:"promo"`
	Field any `json:"field"`
	Progress any `json:"progress"`
	Value any `json:"value"`
}

// The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.
templ CartSummaryCard(p CartSummaryCardProps) {
	{{ vLines := p.Lines }}
	{{ vRows := p.Rows }}
	{{ vPromos := p.Promos }}
	{{ vLabels := p.Labels }}
	{{ vItems := uiutils.Def(p.Items, "hide") }}
	{{ vPromo := uiutils.Def(p.Promo, "show") }}
	{{ vField := uiutils.Def(p.Field, "promo") }}
	{{ vProgress := uiutils.Def(p.Progress, "show") }}
	{{ vValue := uiutils.Def(p.Value, float64(70)) }}
	@compose.Stack(compose.StackProps{Gap: "6", Align: "stretch", BoxProps: box.BoxProps{Class: "rounded bg-card inset-ring inset-ring-border p-6", Attrs: uiutils.Attrs("data-slot", "summary")}}) {
		@compose.Group(compose.GroupProps{Gap: "4", Align: "baseline", Justify: "between", BoxProps: box.BoxProps{}}) {
			@compose.Title(compose.TitleProps{As: "2", Size: "lg", Weight: "semibold", TextProps: text.TextProps{}}) {
				{ uiutils.Text(uiutils.Get(vLabels, "title")) }
			}
			@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
				{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "items"), uiutils.Str(uiutils.Len(vLines)))) }
			}
		}
		if uiutils.T(uiutils.And(uiutils.Eq(vItems, "show"), uiutils.Gt(uiutils.Len(vLines), float64(0)))) {
			@compose.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ul", Class: "flex flex-col gap-4", Attrs: uiutils.Attrs("data-slot", "summary-lines")}}) {
				for _, vLine := range uiutils.L(vLines) {
					@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex items-center gap-4 text-sm", Attrs: uiutils.Attrs("data-slot", "cart-line")}}) {
						@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vLine, "name"), Src: uiutils.Get(vLine, "image"), Ratio: "1/1", Class: uiutils.Cnv("size-12 shrink-0")})
						@compose.Stack(compose.StackProps{Gap: "0", BoxProps: box.BoxProps{Class: "flex-1"}}) {
							@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
								{ uiutils.Text(uiutils.Get(vLine, "name")) }
							}
							@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
								{ uiutils.Text(uiutils.Tpl("{0} x {1}", uiutils.Get(vLine, "qty"), uiutils.Money(uiutils.Get(vLine, "price"), uiutils.Get(vLine, "currency")))) }
							}
						}
						@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "font-medium"}}) {
							{ uiutils.Text(uiutils.Money(uiutils.Mul(uiutils.Get(vLine, "price"), uiutils.Get(vLine, "qty")), uiutils.Get(vLine, "currency"))) }
						}
					}
				}
			}
		}
		if uiutils.Eq(vPromo, "show") {
			@compose.Stack(compose.StackProps{Gap: "2", Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "promo")}}) {
				@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{}}) {
					@compose.Input(compose.InputProps{InputProps: input.InputProps{Type: "text", Name: uiutils.S(vField), Placeholder: uiutils.S(uiutils.Get(vLabels, "promo")), Class: "min-w-0 flex-1", Attrs: uiutils.Attrs("aria-label", uiutils.Get(vLabels, "promo"))}})
					@compose.Button(compose.ButtonProps{Variant: "outline", Size: "default", ButtonProps: button.ButtonProps{Type: "button"}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "apply")) }
					}
				}
				if uiutils.Gt(uiutils.Len(vPromos), float64(0)) {
					@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{Class: "flex-wrap"}}) {
						@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
							{ uiutils.Text(uiutils.Get(vLabels, "codes")) }
						}
						for _, vC := range uiutils.L(vPromos) {
							@compose.Badge(compose.BadgeProps{Variant: "outline", Size: "sm", TextProps: text.TextProps{}}) {
								{ uiutils.Text(uiutils.Get(vC, "code")) }
							}
						}
					}
				}
			}
		}
		if uiutils.Eq(vProgress, "show") {
			@compose.Stack(compose.StackProps{Gap: "2", Align: "stretch", BoxProps: box.BoxProps{Class: "rounded bg-muted p-4", Attrs: uiutils.Attrs("data-slot", "progress")}}) {
				@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{}}) {
					{ uiutils.Text(uiutils.Get(vLabels, "progress")) }
				}
				@compose.Progress(compose.ProgressProps{ProgressProps: progress.ProgressProps{Value: uiutils.SP(uiutils.Str(vValue)), Max: "100", Attrs: uiutils.Attrs("aria-label", uiutils.Get(vLabels, "progress"))}})
			}
		}
		if uiutils.Gt(uiutils.Len(vRows), float64(0)) {
			@compose.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ul", Class: "flex flex-col gap-2"}}) {
				for _, vRow := range uiutils.L(vRows) {
					@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("flex items-center justify-between gap-4", uiutils.Cond(uiutils.T(uiutils.Get(vRow, "strong")), "border-t border-border pt-4 text-base font-bold", "text-sm text-muted-foreground"))), Attrs: uiutils.Attrs("data-slot", "row")}}) {
						@compose.Inline(compose.InlineProps{TextProps: text.TextProps{}}) {
							{ uiutils.Text(uiutils.Get(vRow, "label")) }
						}
						@compose.Inline(compose.InlineProps{TextProps: text.TextProps{}}) {
							{ uiutils.Text(uiutils.Money(uiutils.Get(vRow, "amount"), uiutils.Get(vRow, "currency"))) }
						}
					}
				}
			}
		}
		@compose.Button(compose.ButtonProps{Variant: "default", Size: "lg", ButtonProps: button.ButtonProps{Class: "w-full"}}) {
			{ uiutils.Text(uiutils.Get(vLabels, "checkout")) }
		}
		@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
			{ uiutils.Text(uiutils.Get(vLabels, "note")) }
		}
	}
}

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 cart-summary-card
blocks/cart-summary-card.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/cart-summary-card.json
    The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.
    Props (p): lines, rows, promos, labels, items, promo, field, progress, value. -#}
{%- set v_lines = (p.lines ?? null) -%}
{%- set v_rows = (p.rows ?? null) -%}
{%- set v_promos = (p.promos ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_items = (p.items ?? 'hide') -%}
{%- set v_promo = (p.promo ?? 'show') -%}
{%- set v_field = (p.field ?? 'promo') -%}
{%- set v_progress = (p.progress ?? 'show') -%}
{%- set v_value = (p.value ?? 70) -%}
{%- set c_24 -%}
  {%- set c_3 -%}
    {%- set c_1 -%}
      {{ og_text(og_get(v_labels, ['title'])) }}
    {%- endset -%}
    {{ include('compose/Title.html.twig', {'as': 2, 'size': 'lg', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
    {%- set c_2 -%}
      {{ og_text(og_tpl(og_get(v_labels, ['items']), [og_str(og_len(v_lines))])) }}
    {%- endset -%}
    {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'baseline', 'justify': 'between', 'children': c_3}, with_context = false) }}
  {%- if og_t(og_and([og_eq(v_items, 'show'), og_gt(og_len(v_lines), 0)])) %}
    {%- set c_9 -%}
      {%- for v_line in og_l(v_lines) %}
        {%- set c_8 -%}
          {{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_line, ['name']), 'src': og_get(v_line, ['image']), 'ratio': '1/1', 'className': og_cnv(['size-12 shrink-0'])}}, with_context = false) }}
          {%- set c_6 -%}
            {%- set c_4 -%}
              {{ og_text(og_get(v_line, ['name'])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_4}, with_context = false) }}
            {%- set c_5 -%}
              {{ og_text(og_tpl('{0} x {1}', [og_get(v_line, ['qty']), og_money(og_get(v_line, ['price']), og_get(v_line, ['currency']))])) }}
            {%- endset -%}
            {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_5}, with_context = false) }}
          {%- endset -%}
          {{ include('compose/Stack.html.twig', {'gap': '0', 'class': 'flex-1', 'children': c_6}, with_context = false) }}
          {%- set c_7 -%}
            {{ og_text(og_money(og_mul(og_get(v_line, ['price']), og_get(v_line, ['qty'])), og_get(v_line, ['currency']))) }}
          {%- endset -%}
          {{ include('compose/Inline.html.twig', {'class': 'font-medium', 'children': c_7}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/ListItem.html.twig', {'class': 'flex items-center gap-4 text-sm', 'attrs': og_attrs(['data-slot', 'cart-line']), 'children': c_8}, with_context = false) }}
      {%- endfor %}
    {%- endset -%}
    {{ include('compose/List.html.twig', {'tag': 'ul', 'class': 'flex flex-col gap-4', 'attrs': og_attrs(['data-slot', 'summary-lines']), 'children': c_9}, with_context = false) }}
  {%- endif %}
  {%- if og_t(og_eq(v_promo, 'show')) %}
    {%- set c_15 -%}
      {%- set c_11 -%}
        {{ include('compose/Input.html.twig', {'type': 'text', 'name': og_s(v_field), 'placeholder': og_s(og_get(v_labels, ['promo'])), 'class': 'min-w-0 flex-1', 'attrs': og_attrs(['aria-label', og_get(v_labels, ['promo'])])}, with_context = false) }}
        {%- set c_10 -%}
          {{ og_text(og_get(v_labels, ['apply'])) }}
        {%- endset -%}
        {{ include('compose/Button.html.twig', {'variant': 'outline', 'size': 'default', 'type': 'button', 'children': c_10}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'children': c_11}, with_context = false) }}
      {%- if og_t(og_gt(og_len(v_promos), 0)) %}
        {%- set c_14 -%}
          {%- set c_12 -%}
            {{ og_text(og_get(v_labels, ['codes'])) }}
          {%- endset -%}
          {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_12}, with_context = false) }}
          {%- for v_c in og_l(v_promos) %}
            {%- set c_13 -%}
              {{ og_text(og_get(v_c, ['code'])) }}
            {%- endset -%}
            {{ include('compose/Badge.html.twig', {'variant': 'outline', 'size': 'sm', 'children': c_13}, with_context = false) }}
          {%- endfor %}
        {%- endset -%}
        {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'class': 'flex-wrap', 'children': c_14}, with_context = false) }}
      {%- endif %}
    {%- endset -%}
    {{ include('compose/Stack.html.twig', {'gap': '2', 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'promo']), 'children': c_15}, with_context = false) }}
  {%- endif %}
  {%- if og_t(og_eq(v_progress, 'show')) %}
    {%- set c_17 -%}
      {%- set c_16 -%}
        {{ og_text(og_get(v_labels, ['progress'])) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'sm', 'children': c_16}, with_context = false) }}
      {{ include('compose/Progress.html.twig', {'value': og_s(og_str(v_value)), 'max': '100', 'attrs': og_attrs(['aria-label', og_get(v_labels, ['progress'])])}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Stack.html.twig', {'gap': '2', 'align': 'stretch', 'class': 'rounded bg-muted p-4', 'attrs': og_attrs(['data-slot', 'progress']), 'children': c_17}, with_context = false) }}
  {%- endif %}
  {%- if og_t(og_gt(og_len(v_rows), 0)) %}
    {%- set c_21 -%}
      {%- for v_row in og_l(v_rows) %}
        {%- set c_20 -%}
          {%- set c_18 -%}
            {{ og_text(og_get(v_row, ['label'])) }}
          {%- endset -%}
          {{ include('compose/Inline.html.twig', {'children': c_18}, with_context = false) }}
          {%- set c_19 -%}
            {{ og_text(og_money(og_get(v_row, ['amount']), og_get(v_row, ['currency']))) }}
          {%- endset -%}
          {{ include('compose/Inline.html.twig', {'children': c_19}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/ListItem.html.twig', {'class': og_s(og_cnv(['flex items-center justify-between gap-4', (og_t(og_get(v_row, ['strong'])) ? 'border-t border-border pt-4 text-base font-bold' : 'text-sm text-muted-foreground')])), 'attrs': og_attrs(['data-slot', 'row']), 'children': c_20}, with_context = false) }}
      {%- endfor %}
    {%- endset -%}
    {{ include('compose/List.html.twig', {'tag': 'ul', 'class': 'flex flex-col gap-2', 'children': c_21}, with_context = false) }}
  {%- endif %}
  {%- set c_22 -%}
    {{ og_text(og_get(v_labels, ['checkout'])) }}
  {%- endset -%}
  {{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'lg', 'class': 'w-full', 'children': c_22}, with_context = false) }}
  {%- set c_23 -%}
    {{ og_text(og_get(v_labels, ['note'])) }}
  {%- endset -%}
  {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_23}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '6', 'align': 'stretch', 'class': 'rounded bg-card inset-ring inset-ring-border p-6', 'attrs': og_attrs(['data-slot', 'summary']), 'children': c_24}, 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 cart-summary-card
blocks/cart-summary-card.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/cart-summary-card.json
    The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.
    Props (p): lines, rows, promos, labels, items, promo, field, progress, value. *}
{var $v_lines = ($p['lines'] ?? null)}
{var $v_rows = ($p['rows'] ?? null)}
{var $v_promos = ($p['promos'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_items = ($p['items'] ?? 'hide')}
{var $v_promo = ($p['promo'] ?? 'show')}
{var $v_field = ($p['field'] ?? 'promo')}
{var $v_progress = ($p['progress'] ?? 'show')}
{var $v_value = ($p['value'] ?? 70)}
{capture $c_24}
  {capture $c_3}
    {capture $c_1}
      {=og_text(og_get($v_labels, ['title']))}
    {/capture}
    {=og_include('compose/Title.latte', ['as' => 2, 'size' => 'lg', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
    {capture $c_2}
      {=og_text(og_tpl(og_get($v_labels, ['items']), [og_str(og_len($v_lines))]))}
    {/capture}
    {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
  {/capture}
  {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'baseline', 'justify' => 'between', 'children' => (string) $c_3])|noescape}
  {if og_t(og_and([og_eq($v_items, 'show'), og_gt(og_len($v_lines), 0)]))}
    {capture $c_9}
      {foreach og_l($v_lines) as $v_line}
        {capture $c_8}
          {=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_line, ['name']), 'src' => og_get($v_line, ['image']), 'ratio' => '1/1', 'className' => og_cnv(['size-12 shrink-0'])]])|noescape}
          {capture $c_6}
            {capture $c_4}
              {=og_text(og_get($v_line, ['name']))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_4])|noescape}
            {capture $c_5}
              {=og_text(og_tpl('{0} x {1}', [og_get($v_line, ['qty']), og_money(og_get($v_line, ['price']), og_get($v_line, ['currency']))]))}
            {/capture}
            {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_5])|noescape}
          {/capture}
          {=og_include('compose/Stack.latte', ['gap' => '0', 'class' => 'flex-1', 'children' => (string) $c_6])|noescape}
          {capture $c_7}
            {=og_text(og_money(og_mul(og_get($v_line, ['price']), og_get($v_line, ['qty'])), og_get($v_line, ['currency'])))}
          {/capture}
          {=og_include('compose/Inline.latte', ['class' => 'font-medium', 'children' => (string) $c_7])|noescape}
        {/capture}
        {=og_include('compose/ListItem.latte', ['class' => 'flex items-center gap-4 text-sm', 'attrs' => og_attrs(['data-slot', 'cart-line']), 'children' => (string) $c_8])|noescape}
      {/foreach}
    {/capture}
    {=og_include('compose/List.latte', ['tag' => 'ul', 'class' => 'flex flex-col gap-4', 'attrs' => og_attrs(['data-slot', 'summary-lines']), 'children' => (string) $c_9])|noescape}
  {/if}
  {if og_t(og_eq($v_promo, 'show'))}
    {capture $c_15}
      {capture $c_11}
        {=og_include('compose/Input.latte', ['type' => 'text', 'name' => og_s($v_field), 'placeholder' => og_s(og_get($v_labels, ['promo'])), 'class' => 'min-w-0 flex-1', 'attrs' => og_attrs(['aria-label', og_get($v_labels, ['promo'])])])|noescape}
        {capture $c_10}
          {=og_text(og_get($v_labels, ['apply']))}
        {/capture}
        {=og_include('compose/Button.latte', ['variant' => 'outline', 'size' => 'default', 'type' => 'button', 'children' => (string) $c_10])|noescape}
      {/capture}
      {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'children' => (string) $c_11])|noescape}
      {if og_t(og_gt(og_len($v_promos), 0))}
        {capture $c_14}
          {capture $c_12}
            {=og_text(og_get($v_labels, ['codes']))}
          {/capture}
          {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_12])|noescape}
          {foreach og_l($v_promos) as $v_c}
            {capture $c_13}
              {=og_text(og_get($v_c, ['code']))}
            {/capture}
            {=og_include('compose/Badge.latte', ['variant' => 'outline', 'size' => 'sm', 'children' => (string) $c_13])|noescape}
          {/foreach}
        {/capture}
        {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'class' => 'flex-wrap', 'children' => (string) $c_14])|noescape}
      {/if}
    {/capture}
    {=og_include('compose/Stack.latte', ['gap' => '2', 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'promo']), 'children' => (string) $c_15])|noescape}
  {/if}
  {if og_t(og_eq($v_progress, 'show'))}
    {capture $c_17}
      {capture $c_16}
        {=og_text(og_get($v_labels, ['progress']))}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'sm', 'children' => (string) $c_16])|noescape}
      {=og_include('compose/Progress.latte', ['value' => og_s(og_str($v_value)), 'max' => '100', 'attrs' => og_attrs(['aria-label', og_get($v_labels, ['progress'])])])|noescape}
    {/capture}
    {=og_include('compose/Stack.latte', ['gap' => '2', 'align' => 'stretch', 'class' => 'rounded bg-muted p-4', 'attrs' => og_attrs(['data-slot', 'progress']), 'children' => (string) $c_17])|noescape}
  {/if}
  {if og_t(og_gt(og_len($v_rows), 0))}
    {capture $c_21}
      {foreach og_l($v_rows) as $v_row}
        {capture $c_20}
          {capture $c_18}
            {=og_text(og_get($v_row, ['label']))}
          {/capture}
          {=og_include('compose/Inline.latte', ['children' => (string) $c_18])|noescape}
          {capture $c_19}
            {=og_text(og_money(og_get($v_row, ['amount']), og_get($v_row, ['currency'])))}
          {/capture}
          {=og_include('compose/Inline.latte', ['children' => (string) $c_19])|noescape}
        {/capture}
        {=og_include('compose/ListItem.latte', ['class' => og_s(og_cnv(['flex items-center justify-between gap-4', (og_t(og_get($v_row, ['strong'])) ? 'border-t border-border pt-4 text-base font-bold' : 'text-sm text-muted-foreground')])), 'attrs' => og_attrs(['data-slot', 'row']), 'children' => (string) $c_20])|noescape}
      {/foreach}
    {/capture}
    {=og_include('compose/List.latte', ['tag' => 'ul', 'class' => 'flex flex-col gap-2', 'children' => (string) $c_21])|noescape}
  {/if}
  {capture $c_22}
    {=og_text(og_get($v_labels, ['checkout']))}
  {/capture}
  {=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'lg', 'class' => 'w-full', 'children' => (string) $c_22])|noescape}
  {capture $c_23}
    {=og_text(og_get($v_labels, ['note']))}
  {/capture}
  {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_23])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '6', 'align' => 'stretch', 'class' => 'rounded bg-card inset-ring inset-ring-border p-6', 'attrs' => og_attrs(['data-slot', 'summary']), 'children' => (string) $c_24])|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 cart-summary-card
blocks/cart-summary-card.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/cart-summary-card.json
    The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.
    Props (p): lines, rows, promos, labels, items, promo, field, progress, value. -#}
{%- set v_lines = og_def(p['lines'], none) -%}
{%- set v_rows = og_def(p['rows'], none) -%}
{%- set v_promos = og_def(p['promos'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_items = og_def(p['items'], 'hide') -%}
{%- set v_promo = og_def(p['promo'], 'show') -%}
{%- set v_field = og_def(p['field'], 'promo') -%}
{%- set v_progress = og_def(p['progress'], 'show') -%}
{%- set v_value = og_def(p['value'], 70) -%}
{%- set c_24 -%}
  {%- set c_3 -%}
    {%- set c_1 -%}
      {{ og_text(og_get(v_labels, ['title'])) }}
    {%- endset -%}
    {{ og_include('compose/title.html.j2', {'p': {'As': 2, 'Size': 'lg', 'Weight': 'semibold'}, 'children': c_1}) }}
    {%- set c_2 -%}
      {{ og_text(og_tpl(og_get(v_labels, ['items']), [og_str(og_len(v_lines))])) }}
    {%- endset -%}
    {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
  {%- endset -%}
  {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'baseline', 'Justify': 'between'}, 'children': c_3}) }}
  {%- if og_t(og_and([og_eq(v_items, 'show'), og_gt(og_len(v_lines), 0)])) %}
    {%- set c_9 -%}
      {%- for v_line in og_l(v_lines) %}
        {%- set c_8 -%}
          {{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_line, ['name']), 'src': og_get(v_line, ['image']), 'ratio': '1/1', 'className': og_cnv(['size-12 shrink-0'])}}) }}
          {%- set c_6 -%}
            {%- set c_4 -%}
              {{ og_text(og_get(v_line, ['name'])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_4}) }}
            {%- set c_5 -%}
              {{ og_text(og_tpl('{0} x {1}', [og_get(v_line, ['qty']), og_money(og_get(v_line, ['price']), og_get(v_line, ['currency']))])) }}
            {%- endset -%}
            {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_5}) }}
          {%- endset -%}
          {{ og_include('compose/stack.html.j2', {'p': {'Gap': '0', 'Class': 'flex-1'}, 'children': c_6}) }}
          {%- set c_7 -%}
            {{ og_text(og_money(og_mul(og_get(v_line, ['price']), og_get(v_line, ['qty'])), og_get(v_line, ['currency']))) }}
          {%- endset -%}
          {{ og_include('compose/inline.html.j2', {'p': {'Class': 'font-medium'}, 'children': c_7}) }}
        {%- endset -%}
        {{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex items-center gap-4 text-sm', 'Attrs': og_attrs(['data-slot', 'cart-line'])}, 'children': c_8}) }}
      {%- endfor %}
    {%- endset -%}
    {{ og_include('compose/list.html.j2', {'p': {'Tag': 'ul', 'Class': 'flex flex-col gap-4', 'Attrs': og_attrs(['data-slot', 'summary-lines'])}, 'children': c_9}) }}
  {%- endif %}
  {%- if og_t(og_eq(v_promo, 'show')) %}
    {%- set c_15 -%}
      {%- set c_11 -%}
        {{ og_include('compose/input.html.j2', {'p': {'Type': 'text', 'Name': og_s(v_field), 'Placeholder': og_s(og_get(v_labels, ['promo'])), 'Class': 'min-w-0 flex-1', 'Attrs': og_attrs(['aria-label', og_get(v_labels, ['promo'])])}}) }}
        {%- set c_10 -%}
          {{ og_text(og_get(v_labels, ['apply'])) }}
        {%- endset -%}
        {{ og_include('compose/button.html.j2', {'p': {'Variant': 'outline', 'Size': 'default', 'Type': 'button'}, 'children': c_10}) }}
      {%- endset -%}
      {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center'}, 'children': c_11}) }}
      {%- if og_t(og_gt(og_len(v_promos), 0)) %}
        {%- set c_14 -%}
          {%- set c_12 -%}
            {{ og_text(og_get(v_labels, ['codes'])) }}
          {%- endset -%}
          {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_12}) }}
          {%- for v_c in og_l(v_promos) %}
            {%- set c_13 -%}
              {{ og_text(og_get(v_c, ['code'])) }}
            {%- endset -%}
            {{ og_include('compose/badge.html.j2', {'p': {'Variant': 'outline', 'Size': 'sm'}, 'children': c_13}) }}
          {%- endfor %}
        {%- endset -%}
        {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Class': 'flex-wrap'}, 'children': c_14}) }}
      {%- endif %}
    {%- endset -%}
    {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'promo'])}, 'children': c_15}) }}
  {%- endif %}
  {%- if og_t(og_eq(v_progress, 'show')) %}
    {%- set c_17 -%}
      {%- set c_16 -%}
        {{ og_text(og_get(v_labels, ['progress'])) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm'}, 'children': c_16}) }}
      {{ og_include('compose/progress.html.j2', {'p': {'Value': og_s(og_str(v_value)), 'Max': '100', 'Attrs': og_attrs(['aria-label', og_get(v_labels, ['progress'])])}}) }}
    {%- endset -%}
    {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Align': 'stretch', 'Class': 'rounded bg-muted p-4', 'Attrs': og_attrs(['data-slot', 'progress'])}, 'children': c_17}) }}
  {%- endif %}
  {%- if og_t(og_gt(og_len(v_rows), 0)) %}
    {%- set c_21 -%}
      {%- for v_row in og_l(v_rows) %}
        {%- set c_20 -%}
          {%- set c_18 -%}
            {{ og_text(og_get(v_row, ['label'])) }}
          {%- endset -%}
          {{ og_include('compose/inline.html.j2', {'p': {}, 'children': c_18}) }}
          {%- set c_19 -%}
            {{ og_text(og_money(og_get(v_row, ['amount']), og_get(v_row, ['currency']))) }}
          {%- endset -%}
          {{ og_include('compose/inline.html.j2', {'p': {}, 'children': c_19}) }}
        {%- endset -%}
        {{ og_include('compose/list-item.html.j2', {'p': {'Class': og_s(og_cnv(['flex items-center justify-between gap-4', ('border-t border-border pt-4 text-base font-bold' if og_t(og_get(v_row, ['strong'])) else 'text-sm text-muted-foreground')])), 'Attrs': og_attrs(['data-slot', 'row'])}, 'children': c_20}) }}
      {%- endfor %}
    {%- endset -%}
    {{ og_include('compose/list.html.j2', {'p': {'Tag': 'ul', 'Class': 'flex flex-col gap-2'}, 'children': c_21}) }}
  {%- endif %}
  {%- set c_22 -%}
    {{ og_text(og_get(v_labels, ['checkout'])) }}
  {%- endset -%}
  {{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'lg', 'Class': 'w-full'}, 'children': c_22}) }}
  {%- set c_23 -%}
    {{ og_text(og_get(v_labels, ['note'])) }}
  {%- endset -%}
  {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_23}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '6', 'Align': 'stretch', 'Class': 'rounded bg-card inset-ring inset-ring-border p-6', 'Attrs': og_attrs(['data-slot', 'summary'])}, 'children': c_24}) }}

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.

The order summary card of the cart page and the checkout: the lines in short (optional), a promo code field with ready codes, the free-delivery progress, the totals, the button and a note. Static markup.

Props of CartSummaryCard
PropTypeDefault Description
lines (required)CartLine[]-
rows (required)SummaryRow[]-
promos (required)Promo[]-
labels (required)CartSummaryLabels-
items "show" | "hide""hide"show: the lines in short at the top
promo "show" | "hide""show"
field string"promo"name of the promo code field (unique on the page)
progress "show" | "hide""show"
value number70how far the order is towards free delivery, 0 to 100

Used in