Skip to content
ui8kit

block / marketing

Pricing Card

One plan as a card.

Install

npx ui8kit add pricing-card

Pulls in: badge, block, box, button, card-content, card-description, card-footer, card-header, card-title, compose, group, kit-box, kit-button, kit-text, list, list-item, text, title, utils

Preview

Popular

Team

For a small team

$29

/ month

10 seats

50 GB storage

  • 10 sites
  • Priority support
  • Advanced analytics
  • Custom domains

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 pricing-card
blocks/pricing-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. -->
<!--
  A plan as a card: name, tagline, price per month, the features, a call to action and an optional slot for more
  actions. Text comes in through `labels`; the plan is data.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { Plan, PricingCardLabels } from "./pricing-card.types";

  export type PricingCardProps = {
    plan: Plan;
    labels: PricingCardLabels;
    current?: boolean;
    emphasis?: "auto" | "off";
    density?: "default" | "compact";
    billing?: "monthly" | "annual";
    footer?: Snippet<[Plan]>;
    onselect?: (id: string) => void;
  };
</script>

<script lang="ts">
  import Badge from "../compose/Badge.svelte";
  import Block from "../compose/Block.svelte";
  import Box from "../compose/Box.svelte";
  import Button from "../compose/Button.svelte";
  import CardContent from "../compose/CardContent.svelte";
  import CardDescription from "../compose/CardDescription.svelte";
  import CardFooter from "../compose/CardFooter.svelte";
  import CardHeader from "../compose/CardHeader.svelte";
  import CardTitle from "../compose/CardTitle.svelte";
  import Group from "../compose/Group.svelte";
  import List from "../compose/List.svelte";
  import ListItem from "../compose/ListItem.svelte";
  import Text from "../compose/Text.svelte";
  import Title from "../compose/Title.svelte";
  import { cn, fmtMoney, tpl } from "../utils";

  let {
    plan,
    labels,
    current,
    emphasis = "auto",
    density = "default",
    billing = "monthly",
    footer,
    onselect,
  }: PricingCardProps = $props();
  const stand = $derived(plan.highlighted && ((emphasis as string) === "auto"));
  const yearlyOn = $derived(((billing as string) === "annual") && (plan.yearly > 0));
  const amount = $derived(yearlyOn ? plan.yearly : plan.price);
</script>

<Block
  tag="article"
  class={cn(
    "flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded",
    "flex h-full flex-col"
  )}
  data-slot="card"
  data-highlighted={(stand ? "true" : "false")}
  data-current={(current ? "true" : "false")}
>
  <CardHeader class="flex flex-col gap-2">
    <Box class="flex min-h-6 items-center" data-slot="badge-slot">
      {#if stand}
        <Badge variant="default" size="default">
          {labels.popular}
        </Badge>
      {/if}
    </Box>
    <CardTitle as={3}>
      {plan.name}
    </CardTitle>
    <CardDescription>
      {plan.tagline}
    </CardDescription>
  </CardHeader>
  <CardContent class={cn("flex flex-1 flex-col", (((density as string) === "compact") ? "gap-2" : "gap-4"))}>
    <Group gap="2" align="baseline">
      <Title as={2} size="4xl" weight="bold">
        {#if (amount === 0)}
          {labels.free}
        {:else}
          {fmtMoney(amount, plan.currency)}
        {/if}
      </Title>
      {#if (amount > 0)}
        <Text size="sm" class="text-muted-foreground">
          {(yearlyOn ? labels.perYear : labels.perMonth)}
        </Text>
      {/if}
    </Group>
    <Text size="sm" weight="medium">
      {tpl(labels.seats, plan.seats)}
    </Text>
    <Text size="sm" class="text-muted-foreground">
      {tpl(labels.storage, plan.storage)}
    </Text>
    <List tag="ul" class="flex flex-col gap-2 text-sm">
      {#each plan.features as feature (feature)}
        <ListItem class="flex gap-2" data-slot="features-row">
          {feature}
        </ListItem>
      {/each}
    </List>
  </CardContent>
  <CardFooter class="flex flex-wrap items-center gap-2">
    <Button variant={(stand ? "default" : "outline")} size="default" onclick={() => onselect?.(plan.id)}>
      {labels.cta}
    </Button>
    {@render footer?.(plan)}
  </CardFooter>
</Block>
blocks/pricing-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 Plan = {
  id: string;
  name: string;
  tagline: string;
  price: number;
  currency: string;
  seats: number;
  storage: number;
  highlighted: boolean;
  status?: string;
  features: string[];
  yearly: number;
};

export type PricingCardLabels = {
  popular: string;
  perMonth: string;
  seats: string;
  storage: string;
  cta: string;
  free: string;
  perYear: string;
  empty: string;
};

Svelte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdn
npx ui8kit add pricing-card
blocks/pricing-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.
/**
 * A plan as a card: name, tagline, price per month, the features, a call to action and an optional slot for more
 * actions. Text comes in through `labels`; the plan is data.
 */
import { type ReactNode } from "react";
import { Badge, Block, Box, Button, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Group, List, ListItem, Text, Title } from "../compose";
import { cn, fmtMoney, tpl } from "../utils";
import type { Plan, PricingCardLabels } from "./pricing-card.types";

export type PricingCardProps = {
  plan: Plan;
  labels: PricingCardLabels;
  current?: boolean;
  emphasis?: "auto" | "off";
  density?: "default" | "compact";
  billing?: "monthly" | "annual";
  footer?: (plan: Plan) => ReactNode;
  onSelect?: (id: string) => void;
};

export function PricingCard({
  plan,
  labels,
  current,
  emphasis = "auto",
  density = "default",
  billing = "monthly",
  footer,
  onSelect,
}: PricingCardProps) {
  const stand = plan.highlighted && ((emphasis as string) === "auto");
  const yearlyOn = ((billing as string) === "annual") && (plan.yearly > 0);
  const amount = yearlyOn ? plan.yearly : plan.price;
  return (
    <Block
      tag="article"
      className={cn(
        "flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded",
        "flex h-full flex-col"
      )}
      data-slot="card"
      data-highlighted={(stand ? "true" : "false")}
      data-current={(current ? "true" : "false")}
    >
      <CardHeader className="flex flex-col gap-2">
        <Box className="flex min-h-6 items-center" data-slot="badge-slot">
          {stand ? (
            <Badge variant="default" size="default">
              {labels.popular}
            </Badge>
          ) : null}
        </Box>
        <CardTitle as={3}>
          {plan.name}
        </CardTitle>
        <CardDescription>
          {plan.tagline}
        </CardDescription>
      </CardHeader>
      <CardContent className={cn("flex flex-1 flex-col", (((density as string) === "compact") ? "gap-2" : "gap-4"))}>
        <Group gap="2" align="baseline">
          <Title as={2} size="4xl" weight="bold">
            {(amount === 0) ? (
              <>
                {labels.free}
              </>
            ) : (
              <>
                {fmtMoney(amount, plan.currency)}
              </>
            )}
          </Title>
          {(amount > 0) ? (
            <Text size="sm" className="text-muted-foreground">
              {(yearlyOn ? labels.perYear : labels.perMonth)}
            </Text>
          ) : null}
        </Group>
        <Text size="sm" weight="medium">
          {tpl(labels.seats, plan.seats)}
        </Text>
        <Text size="sm" className="text-muted-foreground">
          {tpl(labels.storage, plan.storage)}
        </Text>
        <List tag="ul" className="flex flex-col gap-2 text-sm">
          {(plan.features ?? []).map((feature) => (
            <ListItem key={feature} className="flex gap-2" data-slot="features-row">
              {feature}
            </ListItem>
          ))}
        </List>
      </CardContent>
      <CardFooter className="flex flex-wrap items-center gap-2">
        <Button variant={(stand ? "default" : "outline")} size="default" onClick={() => onSelect?.(plan.id)}>
          {labels.cta}
        </Button>
        {footer?.(plan)}
      </CardFooter>
    </Block>
  );
}
blocks/pricing-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 Plan = {
  id: string;
  name: string;
  tagline: string;
  price: number;
  currency: string;
  seats: number;
  storage: number;
  highlighted: boolean;
  status?: string;
  features: string[];
  yearly: number;
};

export type PricingCardLabels = {
  popular: string;
  perMonth: string;
  seats: string;
  storage: string;
  cta: string;
  free: string;
  perYear: string;
  empty: string;
};

React registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdn
npx ui8kit add pricing-card
blocks/pricing-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 Plan = {
  id: string;
  name: string;
  tagline: string;
  price: number;
  currency: string;
  seats: number;
  storage: number;
  highlighted: boolean;
  status?: string;
  features: string[];
  yearly: number;
};

export type PricingCardLabels = {
  popular: string;
  perMonth: string;
  seats: string;
  storage: string;
  cta: string;
  free: string;
  perYear: string;
  empty: string;
};
blocks/pricing-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. -->
<!--
  A plan as a card: name, tagline, price per month, the features, a call to action and an optional slot for more
  actions. Text comes in through `labels`; the plan is data.
-->
<script lang="ts">
import type { Plan, PricingCardLabels } from "./pricing-card.types";

export type PricingCardProps = {
  plan: Plan;
  labels: PricingCardLabels;
  current?: boolean;
  emphasis?: "auto" | "off";
  density?: "default" | "compact";
  billing?: "monthly" | "annual";
};
</script>

<script setup lang="ts">
import { computed } from "vue";
import Badge from "../compose/Badge.vue";
import Block from "../compose/Block.vue";
import Box from "../compose/Box.vue";
import Button from "../compose/Button.vue";
import CardContent from "../compose/CardContent.vue";
import CardDescription from "../compose/CardDescription.vue";
import CardFooter from "../compose/CardFooter.vue";
import CardHeader from "../compose/CardHeader.vue";
import CardTitle from "../compose/CardTitle.vue";
import Group from "../compose/Group.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
import { cn, fmtMoney, tpl } from "../utils";

const {
  plan,
  labels,
  current,
  emphasis = "auto",
  density = "default",
  billing = "monthly",
} = defineProps<PricingCardProps>();
const emit = defineEmits<{ select: [id: string] }>();
defineSlots<{ footer?(props: { plan: Plan }): unknown }>();
const stand = computed(() => plan.highlighted && ((emphasis as string) === "auto"));
const yearlyOn = computed(() => ((billing as string) === "annual") && (plan.yearly > 0));
const amount = computed(() => yearlyOn.value ? plan.yearly : plan.price);
</script>

<template>
  <Block
    tag="article"
    :class="cn(
      'flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded',
      'flex h-full flex-col'
    )"
    data-slot="card"
    :data-highlighted="(stand ? 'true' : 'false')"
    :data-current="(current ? 'true' : 'false')"
  >
    <CardHeader class="flex flex-col gap-2">
      <Box class="flex min-h-6 items-center" data-slot="badge-slot">
        <Badge v-if="stand" variant="default" size="default">
          {{ labels.popular }}
        </Badge>
      </Box>
      <CardTitle :as="3">
        {{ plan.name }}
      </CardTitle>
      <CardDescription>
        {{ plan.tagline }}
      </CardDescription>
    </CardHeader>
    <CardContent :class="cn('flex flex-1 flex-col', (((density as string) === 'compact') ? 'gap-2' : 'gap-4'))">
      <Group gap="2" align="baseline">
        <Title :as="2" size="4xl" weight="bold">
          <template v-if="(amount === 0)">
            {{ labels.free }}
          </template>
          <template v-else>
            {{ fmtMoney(amount, plan.currency) }}
          </template>
        </Title>
        <Text v-if="(amount > 0)" size="sm" class="text-muted-foreground">
          {{ (yearlyOn ? labels.perYear : labels.perMonth) }}
        </Text>
      </Group>
      <Text size="sm" weight="medium">
        {{ tpl(labels.seats, plan.seats) }}
      </Text>
      <Text size="sm" class="text-muted-foreground">
        {{ tpl(labels.storage, plan.storage) }}
      </Text>
      <List tag="ul" class="flex flex-col gap-2 text-sm">
        <ListItem v-for="feature in plan.features" :key="feature" class="flex gap-2" data-slot="features-row">
          {{ feature }}
        </ListItem>
      </List>
    </CardContent>
    <CardFooter class="flex flex-wrap items-center gap-2">
      <Button :variant="(stand ? 'default' : 'outline')" size="default" @click="() => emit('select', plan.id)">
        {{ labels.cta }}
      </Button>
      <slot name="footer" :plan="plan" />
    </CardFooter>
  </Block>
</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 pricing-card
blocks/pricing-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.
/**
 * A plan as a card: name, tagline, price per month, the features, a call to action and an optional slot for more
 * actions. Text comes in through `labels`; the plan is data.
 */
import { For, type JSX } from "solid-js";
import { Badge, Block, Box, Button, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Group, List, ListItem, Text, Title } from "../compose";
import { cn, fmtMoney, tpl } from "../utils";
import type { Plan, PricingCardLabels } from "./pricing-card.types";

export type PricingCardProps = {
  plan: Plan;
  labels: PricingCardLabels;
  current?: boolean;
  emphasis?: "auto" | "off";
  density?: "default" | "compact";
  billing?: "monthly" | "annual";
  footer?: (plan: Plan) => JSX.Element;
  onSelect?: (id: string) => void;
};

export function PricingCard({
  plan,
  labels,
  current,
  emphasis = "auto",
  density = "default",
  billing = "monthly",
  footer,
  onSelect,
}: PricingCardProps) {
  const stand = plan.highlighted && ((emphasis as string) === "auto");
  const yearlyOn = ((billing as string) === "annual") && (plan.yearly > 0);
  const amount = yearlyOn ? plan.yearly : plan.price;
  return (
    <Block
      tag="article"
      class={cn(
        "flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded",
        "flex h-full flex-col"
      )}
      data-slot="card"
      data-highlighted={(stand ? "true" : "false")}
      data-current={(current ? "true" : "false")}
    >
      <CardHeader class="flex flex-col gap-2">
        <Box class="flex min-h-6 items-center" data-slot="badge-slot">
          {stand ? (
            <Badge variant="default" size="default">
              {labels.popular}
            </Badge>
          ) : null}
        </Box>
        <CardTitle as={3}>
          {plan.name}
        </CardTitle>
        <CardDescription>
          {plan.tagline}
        </CardDescription>
      </CardHeader>
      <CardContent class={cn("flex flex-1 flex-col", (((density as string) === "compact") ? "gap-2" : "gap-4"))}>
        <Group gap="2" align="baseline">
          <Title as={2} size="4xl" weight="bold">
            {(amount === 0) ? (
              <>
                {labels.free}
              </>
            ) : (
              <>
                {fmtMoney(amount, plan.currency)}
              </>
            )}
          </Title>
          {(amount > 0) ? (
            <Text size="sm" class="text-muted-foreground">
              {(yearlyOn ? labels.perYear : labels.perMonth)}
            </Text>
          ) : null}
        </Group>
        <Text size="sm" weight="medium">
          {tpl(labels.seats, plan.seats)}
        </Text>
        <Text size="sm" class="text-muted-foreground">
          {tpl(labels.storage, plan.storage)}
        </Text>
        <List tag="ul" class="flex flex-col gap-2 text-sm">
          <For each={plan.features ?? []}>{(feature) => (
            <ListItem class="flex gap-2" data-slot="features-row">
              {feature}
            </ListItem>
          )}</For>
        </List>
      </CardContent>
      <CardFooter class="flex flex-wrap items-center gap-2">
        <Button variant={(stand ? "default" : "outline")} size="default" onClick={() => onSelect?.(plan.id)}>
          {labels.cta}
        </Button>
        {footer?.(plan)}
      </CardFooter>
    </Block>
  );
}
blocks/pricing-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 Plan = {
  id: string;
  name: string;
  tagline: string;
  price: number;
  currency: string;
  seats: number;
  storage: number;
  highlighted: boolean;
  status?: string;
  features: string[];
  yearly: number;
};

export type PricingCardLabels = {
  popular: string;
  perMonth: string;
  seats: string;
  storage: string;
  cta: string;
  free: string;
  perYear: string;
  empty: string;
};

Solid registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdn
npx ui8kit add pricing-card
blocks/pricing-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/pricing-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/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// PricingCardProps are the props of PricingCard; the values are the JSON shapes of the TypeScript props.
type PricingCardProps struct {
	Plan any `json:"plan"`
	Labels any `json:"labels"`
	Current any `json:"current"`
	Emphasis any `json:"emphasis"`
	Density any `json:"density"`
	Billing any `json:"billing"`
	Footer func(args ...any) templ.Component `json:"-"`
}

// A plan as a card: name, tagline, price per month, the features, a call to action and an optional slot for more actions. Text comes in through `labels`; the plan is data.
templ PricingCard(p PricingCardProps) {
	{{ vPlan := p.Plan }}
	{{ vLabels := p.Labels }}
	{{ vCurrent := p.Current }}
	{{ vEmphasis := uiutils.Def(p.Emphasis, "auto") }}
	{{ vDensity := uiutils.Def(p.Density, "default") }}
	{{ vBilling := uiutils.Def(p.Billing, "monthly") }}
	{{ vStand := any(uiutils.And(uiutils.Get(vPlan, "highlighted"), uiutils.Eq(vEmphasis, "auto"))) }}
	{{ vYearlyOn := any(uiutils.And(uiutils.Eq(vBilling, "annual"), uiutils.Gt(uiutils.Get(vPlan, "yearly"), float64(0)))) }}
	{{ vAmount := any(uiutils.Cond(uiutils.T(vYearlyOn), uiutils.Get(vPlan, "yearly"), uiutils.Get(vPlan, "price"))) }}
	@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "article", Class: uiutils.S(uiutils.Cnv("flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded", "flex h-full flex-col")), Attrs: uiutils.Attrs("data-slot", "card", "data-highlighted", uiutils.Cond(uiutils.T(vStand), "true", "false"), "data-current", uiutils.Cond(uiutils.T(vCurrent), "true", "false"))}}) {
		@compose.CardHeader(compose.CardHeaderProps{BoxProps: box.BoxProps{Class: "flex flex-col gap-2"}}) {
			@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "flex min-h-6 items-center", Attrs: uiutils.Attrs("data-slot", "badge-slot")}}) {
				if uiutils.T(vStand) {
					@compose.Badge(compose.BadgeProps{Variant: "default", Size: "default", TextProps: text.TextProps{}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "popular")) }
					}
				}
			}
			@compose.CardTitle(compose.CardTitleProps{As: "3", TextProps: text.TextProps{}}) {
				{ uiutils.Text(uiutils.Get(vPlan, "name")) }
			}
			@compose.CardDescription(compose.CardDescriptionProps{TextProps: text.TextProps{}}) {
				{ uiutils.Text(uiutils.Get(vPlan, "tagline")) }
			}
		}
		@compose.CardContent(compose.CardContentProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("flex flex-1 flex-col", uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, "compact")), "gap-2", "gap-4")))}}) {
			@compose.Group(compose.GroupProps{Gap: "2", Align: "baseline", BoxProps: box.BoxProps{}}) {
				@compose.Title(compose.TitleProps{As: "2", Size: "4xl", Weight: "bold", TextProps: text.TextProps{}}) {
					if uiutils.Eq(vAmount, float64(0)) {
						{ uiutils.Text(uiutils.Get(vLabels, "free")) }
					} else {
						{ uiutils.Text(uiutils.Money(vAmount, uiutils.Get(vPlan, "currency"))) }
					}
				}
				if uiutils.Gt(vAmount, float64(0)) {
					@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
						{ uiutils.Text(uiutils.Cond(uiutils.T(vYearlyOn), uiutils.Get(vLabels, "perYear"), uiutils.Get(vLabels, "perMonth"))) }
					}
				}
			}
			@compose.Text(compose.TextProps{Size: "sm", Weight: "medium", TextProps: text.TextProps{}}) {
				{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "seats"), uiutils.Get(vPlan, "seats"))) }
			}
			@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
				{ uiutils.Text(uiutils.Tpl(uiutils.Get(vLabels, "storage"), uiutils.Get(vPlan, "storage"))) }
			}
			@compose.List(compose.ListProps{BoxProps: box.BoxProps{Tag: "ul", Class: "flex flex-col gap-2 text-sm"}}) {
				for _, vFeature := range uiutils.L(uiutils.Get(vPlan, "features")) {
					@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Class: "flex gap-2", Attrs: uiutils.Attrs("data-slot", "features-row")}}) {
						{ uiutils.Text(vFeature) }
					}
				}
			}
		}
		@compose.CardFooter(compose.CardFooterProps{BoxProps: box.BoxProps{Class: "flex flex-wrap items-center gap-2"}}) {
			@compose.Button(compose.ButtonProps{Variant: uiutils.S(uiutils.Cond(uiutils.T(vStand), "default", "outline")), Size: "default", ButtonProps: button.ButtonProps{}}) {
				{ uiutils.Text(uiutils.Get(vLabels, "cta")) }
			}
			if p.Footer != nil {
				@p.Footer(vPlan)
			}
		}
	}
}

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 pricing-card
blocks/pricing-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/pricing-card.json
    A plan as a card: name, tagline, price per month, the features, a call to action and an optional slot for more actions. Text comes in through `labels`; the plan is data.
    Props (p): plan, labels, current, emphasis, density, billing, footer (slot: plan). -#}
{%- set v_plan = (p.plan ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_current = (p.current ?? null) -%}
{%- set v_emphasis = (p.emphasis ?? 'auto') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_billing = (p.billing ?? 'monthly') -%}
{%- set v_stand = og_and([og_get(v_plan, ['highlighted']), og_eq(v_emphasis, 'auto')]) -%}
{%- set v_yearlyOn = og_and([og_eq(v_billing, 'annual'), og_gt(og_get(v_plan, ['yearly']), 0)]) -%}
{%- set v_amount = (og_t(v_yearlyOn) ? og_get(v_plan, ['yearly']) : og_get(v_plan, ['price'])) -%}
{%- set c_16 -%}
  {%- set c_5 -%}
    {%- set c_2 -%}
      {%- if og_t(v_stand) %}
        {%- set c_1 -%}
          {{ og_text(og_get(v_labels, ['popular'])) }}
        {%- endset -%}
        {{ include('compose/Badge.html.twig', {'variant': 'default', 'size': 'default', 'children': c_1}, with_context = false) }}
      {%- endif %}
    {%- endset -%}
    {{ include('compose/Box.html.twig', {'class': 'flex min-h-6 items-center', 'attrs': og_attrs(['data-slot', 'badge-slot']), 'children': c_2}, with_context = false) }}
    {%- set c_3 -%}
      {{ og_text(og_get(v_plan, ['name'])) }}
    {%- endset -%}
    {{ include('compose/CardTitle.html.twig', {'as': 3, 'children': c_3}, with_context = false) }}
    {%- set c_4 -%}
      {{ og_text(og_get(v_plan, ['tagline'])) }}
    {%- endset -%}
    {{ include('compose/CardDescription.html.twig', {'children': c_4}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/CardHeader.html.twig', {'class': 'flex flex-col gap-2', 'children': c_5}, with_context = false) }}
  {%- set c_13 -%}
    {%- set c_8 -%}
      {%- set c_6 -%}
        {%- if og_t(og_eq(v_amount, 0)) %}
          {{ og_text(og_get(v_labels, ['free'])) }}
        {%- else %}
          {{ og_text(og_money(v_amount, og_get(v_plan, ['currency']))) }}
        {%- endif %}
      {%- endset -%}
      {{ include('compose/Title.html.twig', {'as': 2, 'size': '4xl', 'weight': 'bold', 'children': c_6}, with_context = false) }}
      {%- if og_t(og_gt(v_amount, 0)) %}
        {%- set c_7 -%}
          {{ og_text((og_t(v_yearlyOn) ? og_get(v_labels, ['perYear']) : og_get(v_labels, ['perMonth']))) }}
        {%- endset -%}
        {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_7}, with_context = false) }}
      {%- endif %}
    {%- endset -%}
    {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'baseline', 'children': c_8}, with_context = false) }}
    {%- set c_9 -%}
      {{ og_text(og_tpl(og_get(v_labels, ['seats']), [og_get(v_plan, ['seats'])])) }}
    {%- endset -%}
    {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'medium', 'children': c_9}, with_context = false) }}
    {%- set c_10 -%}
      {{ og_text(og_tpl(og_get(v_labels, ['storage']), [og_get(v_plan, ['storage'])])) }}
    {%- endset -%}
    {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_10}, with_context = false) }}
    {%- set c_12 -%}
      {%- for v_feature in og_l(og_get(v_plan, ['features'])) %}
        {%- set c_11 -%}
          {{ og_text(v_feature) }}
        {%- endset -%}
        {{ include('compose/ListItem.html.twig', {'class': 'flex gap-2', 'attrs': og_attrs(['data-slot', 'features-row']), 'children': c_11}, with_context = false) }}
      {%- endfor %}
    {%- endset -%}
    {{ include('compose/List.html.twig', {'tag': 'ul', 'class': 'flex flex-col gap-2 text-sm', 'children': c_12}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/CardContent.html.twig', {'class': og_s(og_cnv(['flex flex-1 flex-col', (og_t(og_eq(v_density, 'compact')) ? 'gap-2' : 'gap-4')])), 'children': c_13}, with_context = false) }}
  {%- set c_15 -%}
    {%- set c_14 -%}
      {{ og_text(og_get(v_labels, ['cta'])) }}
    {%- endset -%}
    {{ include('compose/Button.html.twig', {'variant': og_s((og_t(v_stand) ? 'default' : 'outline')), 'size': 'default', 'children': c_14}, with_context = false) }}
    {%- if (p.footer ?? null) is not null %}
      {{ include(p.footer.t, p.footer.v|merge({'a0': v_plan}), with_context = false) }}
    {%- endif %}
  {%- endset -%}
  {{ include('compose/CardFooter.html.twig', {'class': 'flex flex-wrap items-center gap-2', 'children': c_15}, with_context = false) }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'article', 'class': og_s(og_cnv(['flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded', 'flex h-full flex-col'])), 'attrs': og_attrs(['data-slot', 'card', 'data-highlighted', (og_t(v_stand) ? 'true' : 'false'), 'data-current', (og_t(v_current) ? 'true' : 'false')]), 'children': c_16}, 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 pricing-card
blocks/pricing-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/pricing-card.json
    A plan as a card: name, tagline, price per month, the features, a call to action and an optional slot for more actions. Text comes in through `labels`; the plan is data.
    Props (p): plan, labels, current, emphasis, density, billing, footer (slot: plan). *}
{var $v_plan = ($p['plan'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_current = ($p['current'] ?? null)}
{var $v_emphasis = ($p['emphasis'] ?? 'auto')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_billing = ($p['billing'] ?? 'monthly')}
{var $v_stand = og_and([og_get($v_plan, ['highlighted']), og_eq($v_emphasis, 'auto')])}
{var $v_yearlyOn = og_and([og_eq($v_billing, 'annual'), og_gt(og_get($v_plan, ['yearly']), 0)])}
{var $v_amount = (og_t($v_yearlyOn) ? og_get($v_plan, ['yearly']) : og_get($v_plan, ['price']))}
{capture $c_16}
  {capture $c_5}
    {capture $c_2}
      {if og_t($v_stand)}
        {capture $c_1}
          {=og_text(og_get($v_labels, ['popular']))}
        {/capture}
        {=og_include('compose/Badge.latte', ['variant' => 'default', 'size' => 'default', 'children' => (string) $c_1])|noescape}
      {/if}
    {/capture}
    {=og_include('compose/Box.latte', ['class' => 'flex min-h-6 items-center', 'attrs' => og_attrs(['data-slot', 'badge-slot']), 'children' => (string) $c_2])|noescape}
    {capture $c_3}
      {=og_text(og_get($v_plan, ['name']))}
    {/capture}
    {=og_include('compose/CardTitle.latte', ['as' => 3, 'children' => (string) $c_3])|noescape}
    {capture $c_4}
      {=og_text(og_get($v_plan, ['tagline']))}
    {/capture}
    {=og_include('compose/CardDescription.latte', ['children' => (string) $c_4])|noescape}
  {/capture}
  {=og_include('compose/CardHeader.latte', ['class' => 'flex flex-col gap-2', 'children' => (string) $c_5])|noescape}
  {capture $c_13}
    {capture $c_8}
      {capture $c_6}
        {if og_t(og_eq($v_amount, 0))}
          {=og_text(og_get($v_labels, ['free']))}
        {else}
          {=og_text(og_money($v_amount, og_get($v_plan, ['currency'])))}
        {/if}
      {/capture}
      {=og_include('compose/Title.latte', ['as' => 2, 'size' => '4xl', 'weight' => 'bold', 'children' => (string) $c_6])|noescape}
      {if og_t(og_gt($v_amount, 0))}
        {capture $c_7}
          {=og_text((og_t($v_yearlyOn) ? og_get($v_labels, ['perYear']) : og_get($v_labels, ['perMonth'])))}
        {/capture}
        {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_7])|noescape}
      {/if}
    {/capture}
    {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'baseline', 'children' => (string) $c_8])|noescape}
    {capture $c_9}
      {=og_text(og_tpl(og_get($v_labels, ['seats']), [og_get($v_plan, ['seats'])]))}
    {/capture}
    {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'medium', 'children' => (string) $c_9])|noescape}
    {capture $c_10}
      {=og_text(og_tpl(og_get($v_labels, ['storage']), [og_get($v_plan, ['storage'])]))}
    {/capture}
    {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_10])|noescape}
    {capture $c_12}
      {foreach og_l(og_get($v_plan, ['features'])) as $v_feature}
        {capture $c_11}
          {=og_text($v_feature)}
        {/capture}
        {=og_include('compose/ListItem.latte', ['class' => 'flex gap-2', 'attrs' => og_attrs(['data-slot', 'features-row']), 'children' => (string) $c_11])|noescape}
      {/foreach}
    {/capture}
    {=og_include('compose/List.latte', ['tag' => 'ul', 'class' => 'flex flex-col gap-2 text-sm', 'children' => (string) $c_12])|noescape}
  {/capture}
  {=og_include('compose/CardContent.latte', ['class' => og_s(og_cnv(['flex flex-1 flex-col', (og_t(og_eq($v_density, 'compact')) ? 'gap-2' : 'gap-4')])), 'children' => (string) $c_13])|noescape}
  {capture $c_15}
    {capture $c_14}
      {=og_text(og_get($v_labels, ['cta']))}
    {/capture}
    {=og_include('compose/Button.latte', ['variant' => og_s((og_t($v_stand) ? 'default' : 'outline')), 'size' => 'default', 'children' => (string) $c_14])|noescape}
    {if (($p['footer'] ?? null) !== null)}
      {=og_include($p['footer']['t'], array_merge($p['footer']['v'], ['a0' => $v_plan]))|noescape}
    {/if}
  {/capture}
  {=og_include('compose/CardFooter.latte', ['class' => 'flex flex-wrap items-center gap-2', 'children' => (string) $c_15])|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'article', 'class' => og_s(og_cnv(['flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded', 'flex h-full flex-col'])), 'attrs' => og_attrs(['data-slot', 'card', 'data-highlighted', (og_t($v_stand) ? 'true' : 'false'), 'data-current', (og_t($v_current) ? 'true' : 'false')]), 'children' => (string) $c_16])|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 pricing-card
blocks/pricing-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/pricing-card.json
    A plan as a card: name, tagline, price per month, the features, a call to action and an optional slot for more actions. Text comes in through `labels`; the plan is data.
    Props (p): plan, labels, current, emphasis, density, billing, footer (slot: plan). -#}
{%- set v_plan = og_def(p['plan'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_current = og_def(p['current'], none) -%}
{%- set v_emphasis = og_def(p['emphasis'], 'auto') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_billing = og_def(p['billing'], 'monthly') -%}
{%- set v_stand = og_and([og_get(v_plan, ['highlighted']), og_eq(v_emphasis, 'auto')]) -%}
{%- set v_yearlyOn = og_and([og_eq(v_billing, 'annual'), og_gt(og_get(v_plan, ['yearly']), 0)]) -%}
{%- set v_amount = (og_get(v_plan, ['yearly']) if og_t(v_yearlyOn) else og_get(v_plan, ['price'])) -%}
{%- set c_16 -%}
  {%- set c_5 -%}
    {%- set c_2 -%}
      {%- if og_t(v_stand) %}
        {%- set c_1 -%}
          {{ og_text(og_get(v_labels, ['popular'])) }}
        {%- endset -%}
        {{ og_include('compose/badge.html.j2', {'p': {'Variant': 'default', 'Size': 'default'}, 'children': c_1}) }}
      {%- endif %}
    {%- endset -%}
    {{ og_include('compose/box.html.j2', {'p': {'Class': 'flex min-h-6 items-center', 'Attrs': og_attrs(['data-slot', 'badge-slot'])}, 'children': c_2}) }}
    {%- set c_3 -%}
      {{ og_text(og_get(v_plan, ['name'])) }}
    {%- endset -%}
    {{ og_include('compose/card-title.html.j2', {'p': {'As': 3}, 'children': c_3}) }}
    {%- set c_4 -%}
      {{ og_text(og_get(v_plan, ['tagline'])) }}
    {%- endset -%}
    {{ og_include('compose/card-description.html.j2', {'p': {}, 'children': c_4}) }}
  {%- endset -%}
  {{ og_include('compose/card-header.html.j2', {'p': {'Class': 'flex flex-col gap-2'}, 'children': c_5}) }}
  {%- set c_13 -%}
    {%- set c_8 -%}
      {%- set c_6 -%}
        {%- if og_t(og_eq(v_amount, 0)) %}
          {{ og_text(og_get(v_labels, ['free'])) }}
        {%- else %}
          {{ og_text(og_money(v_amount, og_get(v_plan, ['currency']))) }}
        {%- endif %}
      {%- endset -%}
      {{ og_include('compose/title.html.j2', {'p': {'As': 2, 'Size': '4xl', 'Weight': 'bold'}, 'children': c_6}) }}
      {%- if og_t(og_gt(v_amount, 0)) %}
        {%- set c_7 -%}
          {{ og_text((og_get(v_labels, ['perYear']) if og_t(v_yearlyOn) else og_get(v_labels, ['perMonth']))) }}
        {%- endset -%}
        {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_7}) }}
      {%- endif %}
    {%- endset -%}
    {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'baseline'}, 'children': c_8}) }}
    {%- set c_9 -%}
      {{ og_text(og_tpl(og_get(v_labels, ['seats']), [og_get(v_plan, ['seats'])])) }}
    {%- endset -%}
    {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'medium'}, 'children': c_9}) }}
    {%- set c_10 -%}
      {{ og_text(og_tpl(og_get(v_labels, ['storage']), [og_get(v_plan, ['storage'])])) }}
    {%- endset -%}
    {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_10}) }}
    {%- set c_12 -%}
      {%- for v_feature in og_l(og_get(v_plan, ['features'])) %}
        {%- set c_11 -%}
          {{ og_text(v_feature) }}
        {%- endset -%}
        {{ og_include('compose/list-item.html.j2', {'p': {'Class': 'flex gap-2', 'Attrs': og_attrs(['data-slot', 'features-row'])}, 'children': c_11}) }}
      {%- endfor %}
    {%- endset -%}
    {{ og_include('compose/list.html.j2', {'p': {'Tag': 'ul', 'Class': 'flex flex-col gap-2 text-sm'}, 'children': c_12}) }}
  {%- endset -%}
  {{ og_include('compose/card-content.html.j2', {'p': {'Class': og_s(og_cnv(['flex flex-1 flex-col', ('gap-2' if og_t(og_eq(v_density, 'compact')) else 'gap-4')]))}, 'children': c_13}) }}
  {%- set c_15 -%}
    {%- set c_14 -%}
      {{ og_text(og_get(v_labels, ['cta'])) }}
    {%- endset -%}
    {{ og_include('compose/button.html.j2', {'p': {'Variant': og_s(('default' if og_t(v_stand) else 'outline')), 'Size': 'default'}, 'children': c_14}) }}
    {%- if og_def(p['footer'], none) is not none %}
      {{ og_include(p['footer']['t'], og_merge(p['footer']['v'], {'a0': v_plan})) }}
    {%- endif %}
  {%- endset -%}
  {{ og_include('compose/card-footer.html.j2', {'p': {'Class': 'flex flex-wrap items-center gap-2'}, 'children': c_15}) }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'article', 'Class': og_s(og_cnv(['flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded', 'flex h-full flex-col'])), 'Attrs': og_attrs(['data-slot', 'card', 'data-highlighted', ('true' if og_t(v_stand) else 'false'), 'data-current', ('true' if og_t(v_current) else 'false')])}, 'children': c_16}) }}

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.

A plan as a card: name, tagline, price per month, the features, a call to action and an optional slot for more actions. Text comes in through `labels`; the plan is data.

Props of PricingCard
PropTypeDefault Description
plan (required)Plan-
labels (required)PricingCardLabels-
current boolean-marks the plan as the chosen one
emphasis "auto" | "off""auto"auto: the highlighted plan stands out; off: all plans alike
density "default" | "compact""default"compact: tighter content
billing "monthly" | "annual""monthly"annual: the yearly price of the plan, when it has one

Used in