Pricing Tiers
Plans as a grid or a stack of cards.
Install
npx ui8kit add pricing-tiersPulls in: badge, compose, empty-state, grid, group, kit-box, kit-text, pricing-card, section-frame, switcher, switcher-item, utils
Preview
Plans
Solo
One person, one site
Free
1 seats
2 GB storage
- 1 site
- Community support
- Basic analytics
Team
For a small team
$29
/ month
10 seats
50 GB storage
- 10 sites
- Priority support
- Advanced analytics
- Custom domains
Scale
For many sites and editors
$99
/ month
50 seats
500 GB storage
- Unlimited sites
- Dedicated support
- Audit log
- Single sign-on
Code
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdnnpx ui8kit add pricing-tiers<!-- 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 section with a heading and one PricingCard per plan; an empty state when there are none. Axes: layout (grid,
stack), columns, emphasis, billing (off: no toggle; monthly or annual: a toggle with that choice selected, and
the prices of that period), density, tone.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { BillingLabels } from "./pricing-tiers.types";
import type { Plan, PricingCardLabels } from "./pricing-card.types";
export type PricingTiersProps = {
id: string;
title: string;
plans: Plan[];
labels: PricingCardLabels;
billingLabels: BillingLabels;
layout?: "grid" | "stack";
cols?: "1-2" | "1-3" | "1-4";
emphasis?: "auto" | "off";
billing?: "off" | "monthly" | "annual";
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
landmarkLabel?: string;
onselect?: (id: string) => void;
onbilling?: (period: string) => void;
};
</script>
<script lang="ts">
import Badge from "../compose/Badge.svelte";
import Grid from "../compose/Grid.svelte";
import Group from "../compose/Group.svelte";
import EmptyState from "../components/empty-state.svelte";
import PricingCard from "../blocks/pricing-card.svelte";
import SectionFrame from "../components/section-frame.svelte";
import Switcher from "../components/switcher.svelte";
import SwitcherItem from "../components/switcher-item.svelte";
import { fitCols } from "../utils";
let {
id,
title,
plans,
labels,
billingLabels,
layout = "grid",
cols = "1-3",
emphasis = "auto",
billing = "off",
tone = "default",
density = "default",
landmarkLabel,
onselect,
onbilling,
}: PricingTiersProps = $props();
</script>
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
measure={(((layout as string) === "stack") ? "md" : "default")}
landmarkLabel={landmarkLabel}
>
{#if ((billing as string) !== "off")}
<Group gap="4" align="center" justify="center" class="flex-wrap" data-slot="billing">
<Switcher label={billingLabels.label}>
<SwitcherItem active={((billing as string) === "monthly")} onclick={() => onbilling?.("monthly")}>
{billingLabels.monthly}
</SwitcherItem>
<SwitcherItem active={((billing as string) === "annual")} onclick={() => onbilling?.("annual")}>
{billingLabels.annual}
</SwitcherItem>
</Switcher>
<Badge variant="default" size="default">
{billingLabels.save}
</Badge>
</Group>
{/if}
{#if ((plans?.length ?? 0) === 0)}
<EmptyState icon="layers" title={labels.empty} />
{:else}
<Grid
cols={(((layout as string) === "stack") ? "1" : fitCols(cols, (plans?.length ?? 0)))}
class="gap-4"
data-slot="tiers"
>
{#each plans as plan (plan.id)}
<PricingCard
plan={plan}
labels={labels}
emphasis={emphasis}
billing={(((billing as string) === "annual") ? "annual" : "monthly")}
density={(((density as string) === "compact") ? "compact" : "default")}
onselect={() => onselect?.(plan.id)}
/>
{/each}
</Grid>
{/if}
</SectionFrame>
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
export type BillingLabels = {
label: string;
monthly: string;
annual: string;
save: string;
};
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdnnpx ui8kit add pricing-tiers// 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 section with a heading and one PricingCard per plan; an empty state when there are none. Axes: layout (grid,
* stack), columns, emphasis, billing (off: no toggle; monthly or annual: a toggle with that choice selected, and
* the prices of that period), density, tone.
*/
import { type ReactNode } from "react";
import { Badge, Grid, Group } from "../compose";
import { EmptyState } from "../components/empty-state";
import { PricingCard } from "../blocks/pricing-card";
import { SectionFrame } from "../components/section-frame";
import { Switcher } from "../components/switcher";
import { SwitcherItem } from "../components/switcher-item";
import { fitCols } from "../utils";
import type { BillingLabels } from "./pricing-tiers.types";
import type { Plan, PricingCardLabels } from "./pricing-card.types";
export type PricingTiersProps = {
id: string;
title: string;
plans: Plan[];
labels: PricingCardLabels;
billingLabels: BillingLabels;
layout?: "grid" | "stack";
cols?: "1-2" | "1-3" | "1-4";
emphasis?: "auto" | "off";
billing?: "off" | "monthly" | "annual";
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
landmarkLabel?: string;
onSelect?: (id: string) => void;
onBilling?: (period: string) => void;
};
export function PricingTiers({
id,
title,
plans,
labels,
billingLabels,
layout = "grid",
cols = "1-3",
emphasis = "auto",
billing = "off",
tone = "default",
density = "default",
landmarkLabel,
onSelect,
onBilling,
}: PricingTiersProps) {
return (
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
measure={(((layout as string) === "stack") ? "md" : "default")}
landmarkLabel={landmarkLabel}
>
{((billing as string) !== "off") ? (
<Group gap="4" align="center" justify="center" className="flex-wrap" data-slot="billing">
<Switcher label={billingLabels.label}>
<SwitcherItem active={((billing as string) === "monthly")} onClick={() => onBilling?.("monthly")}>
{billingLabels.monthly}
</SwitcherItem>
<SwitcherItem active={((billing as string) === "annual")} onClick={() => onBilling?.("annual")}>
{billingLabels.annual}
</SwitcherItem>
</Switcher>
<Badge variant="default" size="default">
{billingLabels.save}
</Badge>
</Group>
) : null}
{((plans?.length ?? 0) === 0) ? (
<EmptyState icon="layers" title={labels.empty} />
) : (
<Grid
cols={(((layout as string) === "stack") ? "1" : fitCols(cols, (plans?.length ?? 0)))}
className="gap-4"
data-slot="tiers"
>
{(plans ?? []).map((plan) => (
<PricingCard key={plan.id}
plan={plan}
labels={labels}
emphasis={emphasis}
billing={(((billing as string) === "annual") ? "annual" : "monthly")}
density={(((density as string) === "compact") ? "compact" : "default")}
onSelect={() => onSelect?.(plan.id)}
/>
))}
</Grid>
)}
</SectionFrame>
);
}
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
export type BillingLabels = {
label: string;
monthly: string;
annual: string;
save: string;
};
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdnnpx ui8kit add pricing-tiers// 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 BillingLabels = {
label: string;
monthly: string;
annual: string;
save: string;
};
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
A section with a heading and one PricingCard per plan; an empty state when there are none. Axes: layout (grid,
stack), columns, emphasis, billing (off: no toggle; monthly or annual: a toggle with that choice selected, and
the prices of that period), density, tone.
-->
<script lang="ts">
import type { BillingLabels } from "./pricing-tiers.types";
import type { Plan, PricingCardLabels } from "./pricing-card.types";
export type PricingTiersProps = {
id: string;
title: string;
plans: Plan[];
labels: PricingCardLabels;
billingLabels: BillingLabels;
layout?: "grid" | "stack";
cols?: "1-2" | "1-3" | "1-4";
emphasis?: "auto" | "off";
billing?: "off" | "monthly" | "annual";
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Badge from "../compose/Badge.vue";
import Grid from "../compose/Grid.vue";
import Group from "../compose/Group.vue";
import EmptyState from "../components/empty-state.vue";
import PricingCard from "../blocks/pricing-card.vue";
import SectionFrame from "../components/section-frame.vue";
import Switcher from "../components/switcher.vue";
import SwitcherItem from "../components/switcher-item.vue";
import { fitCols } from "../utils";
const {
id,
title,
plans,
labels,
billingLabels,
layout = "grid",
cols = "1-3",
emphasis = "auto",
billing = "off",
tone = "default",
density = "default",
landmarkLabel,
} = defineProps<PricingTiersProps>();
const emit = defineEmits<{ select: [id: string], billing: [period: string] }>();
</script>
<template>
<SectionFrame
:id="id"
:title="title"
:tone="tone"
:density="density"
:measure="(((layout as string) === 'stack') ? 'md' : 'default')"
:landmarkLabel="landmarkLabel"
>
<Group
v-if="((billing as string) !== 'off')"
gap="4"
align="center"
justify="center"
class="flex-wrap"
data-slot="billing"
>
<Switcher :label="billingLabels.label">
<SwitcherItem :active="((billing as string) === 'monthly')" @click="() => emit('billing', 'monthly')">
{{ billingLabels.monthly }}
</SwitcherItem>
<SwitcherItem :active="((billing as string) === 'annual')" @click="() => emit('billing', 'annual')">
{{ billingLabels.annual }}
</SwitcherItem>
</Switcher>
<Badge variant="default" size="default">
{{ billingLabels.save }}
</Badge>
</Group>
<EmptyState v-if="((plans?.length ?? 0) === 0)" icon="layers" :title="labels.empty" />
<Grid v-else
:cols="(((layout as string) === 'stack') ? '1' : fitCols(cols, (plans?.length ?? 0)))"
class="gap-4"
data-slot="tiers"
>
<PricingCard v-for="plan in plans" :key="plan.id"
:plan="plan"
:labels="labels"
:emphasis="emphasis"
:billing="(((billing as string) === 'annual') ? 'annual' : 'monthly')"
:density="(((density as string) === 'compact') ? 'compact' : 'default')"
@select="() => emit('select', plan.id)"
/>
</Grid>
</SectionFrame>
</template>
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdnnpx ui8kit add pricing-tiers// 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 section with a heading and one PricingCard per plan; an empty state when there are none. Axes: layout (grid,
* stack), columns, emphasis, billing (off: no toggle; monthly or annual: a toggle with that choice selected, and
* the prices of that period), density, tone.
*/
import { For, type JSX } from "solid-js";
import { Badge, Grid, Group } from "../compose";
import { EmptyState } from "../components/empty-state";
import { PricingCard } from "../blocks/pricing-card";
import { SectionFrame } from "../components/section-frame";
import { Switcher } from "../components/switcher";
import { SwitcherItem } from "../components/switcher-item";
import { fitCols } from "../utils";
import type { BillingLabels } from "./pricing-tiers.types";
import type { Plan, PricingCardLabels } from "./pricing-card.types";
export type PricingTiersProps = {
id: string;
title: string;
plans: Plan[];
labels: PricingCardLabels;
billingLabels: BillingLabels;
layout?: "grid" | "stack";
cols?: "1-2" | "1-3" | "1-4";
emphasis?: "auto" | "off";
billing?: "off" | "monthly" | "annual";
tone?: "default" | "muted";
density?: "roomy" | "default" | "compact";
landmarkLabel?: string;
onSelect?: (id: string) => void;
onBilling?: (period: string) => void;
};
export function PricingTiers({
id,
title,
plans,
labels,
billingLabels,
layout = "grid",
cols = "1-3",
emphasis = "auto",
billing = "off",
tone = "default",
density = "default",
landmarkLabel,
onSelect,
onBilling,
}: PricingTiersProps) {
return (
<SectionFrame
id={id}
title={title}
tone={tone}
density={density}
measure={(((layout as string) === "stack") ? "md" : "default")}
landmarkLabel={landmarkLabel}
>
{((billing as string) !== "off") ? (
<Group gap="4" align="center" justify="center" class="flex-wrap" data-slot="billing">
<Switcher label={billingLabels.label}>
<SwitcherItem active={((billing as string) === "monthly")} onClick={() => onBilling?.("monthly")}>
{billingLabels.monthly}
</SwitcherItem>
<SwitcherItem active={((billing as string) === "annual")} onClick={() => onBilling?.("annual")}>
{billingLabels.annual}
</SwitcherItem>
</Switcher>
<Badge variant="default" size="default">
{billingLabels.save}
</Badge>
</Group>
) : null}
{((plans?.length ?? 0) === 0) ? (
<EmptyState icon="layers" title={labels.empty} />
) : (
<Grid
cols={(((layout as string) === "stack") ? "1" : fitCols(cols, (plans?.length ?? 0)))}
class="gap-4"
data-slot="tiers"
>
<For each={plans ?? []}>{(plan) => (
<PricingCard
plan={plan}
labels={labels}
emphasis={emphasis}
billing={(((billing as string) === "annual") ? "annual" : "monthly")}
density={(((density as string) === "compact") ? "compact" : "default")}
onSelect={() => onSelect?.(plan.id)}
/>
)}</For>
</Grid>
)}
</SectionFrame>
);
}
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
export type BillingLabels = {
label: string;
monthly: string;
annual: string;
save: string;
};
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdnnpx ui8kit add pricing-tiers// 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-tiers.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// PricingTiersProps are the props of PricingTiers; the values are the JSON shapes of the TypeScript props.
type PricingTiersProps struct {
Id any `json:"id"`
Title any `json:"title"`
Plans any `json:"plans"`
Labels any `json:"labels"`
BillingLabels any `json:"billingLabels"`
Layout any `json:"layout"`
Cols any `json:"cols"`
Emphasis any `json:"emphasis"`
Billing any `json:"billing"`
Tone any `json:"tone"`
Density any `json:"density"`
LandmarkLabel any `json:"landmarkLabel"`
}
// A section with a heading and one PricingCard per plan; an empty state when there are none. Axes: layout (grid, stack), columns, emphasis, billing (off: no toggle; monthly or annual: a toggle with that choice selected, and the prices of that period), density, tone.
templ PricingTiers(p PricingTiersProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vPlans := p.Plans }}
{{ vLabels := p.Labels }}
{{ vBillingLabels := p.BillingLabels }}
{{ vLayout := uiutils.Def(p.Layout, "grid") }}
{{ vCols := uiutils.Def(p.Cols, "1-3") }}
{{ vEmphasis := uiutils.Def(p.Emphasis, "auto") }}
{{ vBilling := uiutils.Def(p.Billing, "off") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vDensity := uiutils.Def(p.Density, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, Density: vDensity, Measure: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "stack")), "md", "default"), LandmarkLabel: vLandmarkLabel}) {
if !uiutils.Eq(vBilling, "off") {
@compose.Group(compose.GroupProps{Gap: "4", Align: "center", Justify: "center", BoxProps: box.BoxProps{Class: "flex-wrap", Attrs: uiutils.Attrs("data-slot", "billing")}}) {
@Switcher(SwitcherProps{Label: uiutils.Get(vBillingLabels, "label")}) {
@SwitcherItem(SwitcherItemProps{Active: uiutils.Eq(vBilling, "monthly")}) {
{ uiutils.Text(uiutils.Get(vBillingLabels, "monthly")) }
}
@SwitcherItem(SwitcherItemProps{Active: uiutils.Eq(vBilling, "annual")}) {
{ uiutils.Text(uiutils.Get(vBillingLabels, "annual")) }
}
}
@compose.Badge(compose.BadgeProps{Variant: "default", Size: "default", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vBillingLabels, "save")) }
}
}
}
if uiutils.Eq(uiutils.Len(vPlans), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "layers", Title: uiutils.Get(vLabels, "empty")})
} else {
@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, "stack")), "1", uiutils.FitCols(vCols, uiutils.Len(vPlans)))), BoxProps: box.BoxProps{Class: "gap-4", Attrs: uiutils.Attrs("data-slot", "tiers")}}) {
for _, vPlan := range uiutils.L(vPlans) {
@PricingCard(PricingCardProps{Plan: vPlan, Labels: vLabels, Emphasis: vEmphasis, Billing: uiutils.Cond(uiutils.T(uiutils.Eq(vBilling, "annual")), "annual", "monthly"), Density: uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, "compact")), "compact", "default")})
}
}
}
}
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdnnpx ui8kit add pricing-tiers{#- 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-tiers.json
A section with a heading and one PricingCard per plan; an empty state when there are none. Axes: layout (grid, stack), columns, emphasis, billing (off: no toggle; monthly or annual: a toggle with that choice selected, and the prices of that period), density, tone.
Props (p): id, title, plans, labels, billingLabels, layout, cols, emphasis, billing, tone, density, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_plans = (p.plans ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set v_billingLabels = (p.billingLabels ?? null) -%}
{%- set v_layout = (p.layout ?? 'grid') -%}
{%- set v_cols = (p.cols ?? '1-3') -%}
{%- set v_emphasis = (p.emphasis ?? 'auto') -%}
{%- set v_billing = (p.billing ?? 'off') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_density = (p.density ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_7 -%}
{%- if og_t(not (og_eq(v_billing, 'off'))) %}
{%- set c_5 -%}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_billingLabels, ['monthly'])) }}
{%- endset -%}
{{ include('blocks/switcher-item.html.twig', {'p': {'active': og_eq(v_billing, 'monthly')}, 'children': og_markup(c_1)}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(og_get(v_billingLabels, ['annual'])) }}
{%- endset -%}
{{ include('blocks/switcher-item.html.twig', {'p': {'active': og_eq(v_billing, 'annual')}, 'children': og_markup(c_2)}, with_context = false) }}
{%- endset -%}
{{ include('blocks/switcher.html.twig', {'p': {'label': og_get(v_billingLabels, ['label'])}, 'children': og_markup(c_3)}, with_context = false) }}
{%- set c_4 -%}
{{ og_text(og_get(v_billingLabels, ['save'])) }}
{%- endset -%}
{{ include('compose/Badge.html.twig', {'variant': 'default', 'size': 'default', 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'justify': 'center', 'class': 'flex-wrap', 'attrs': og_attrs(['data-slot', 'billing']), 'children': c_5}, with_context = false) }}
{%- endif %}
{%- if og_t(og_eq(og_len(v_plans), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'layers', 'title': og_get(v_labels, ['empty'])}}, with_context = false) }}
{%- else %}
{%- set c_6 -%}
{%- for v_plan in og_l(v_plans) %}
{{ include('blocks/pricing-card.html.twig', {'p': {'plan': v_plan, 'labels': v_labels, 'emphasis': v_emphasis, 'billing': (og_t(og_eq(v_billing, 'annual')) ? 'annual' : 'monthly'), 'density': (og_t(og_eq(v_density, 'compact')) ? 'compact' : 'default')}}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': og_s((og_t(og_eq(v_layout, 'stack')) ? '1' : og_fit_cols(v_cols, og_len(v_plans)))), 'class': 'gap-4', 'attrs': og_attrs(['data-slot', 'tiers']), 'children': c_6}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'measure': (og_t(og_eq(v_layout, 'stack')) ? 'md' : 'default'), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_7)}, with_context = false) }}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdnnpx ui8kit add pricing-tiers{* 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-tiers.json
A section with a heading and one PricingCard per plan; an empty state when there are none. Axes: layout (grid, stack), columns, emphasis, billing (off: no toggle; monthly or annual: a toggle with that choice selected, and the prices of that period), density, tone.
Props (p): id, title, plans, labels, billingLabels, layout, cols, emphasis, billing, tone, density, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_plans = ($p['plans'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{var $v_billingLabels = ($p['billingLabels'] ?? null)}
{var $v_layout = ($p['layout'] ?? 'grid')}
{var $v_cols = ($p['cols'] ?? '1-3')}
{var $v_emphasis = ($p['emphasis'] ?? 'auto')}
{var $v_billing = ($p['billing'] ?? 'off')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_density = ($p['density'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_7}
{if og_t(!(og_eq($v_billing, 'off')))}
{capture $c_5}
{capture $c_3}
{capture $c_1}
{=og_text(og_get($v_billingLabels, ['monthly']))}
{/capture}
{=og_include('blocks/switcher-item.latte', ['p' => ['active' => og_eq($v_billing, 'monthly')], 'children' => og_markup($c_1)])|noescape}
{capture $c_2}
{=og_text(og_get($v_billingLabels, ['annual']))}
{/capture}
{=og_include('blocks/switcher-item.latte', ['p' => ['active' => og_eq($v_billing, 'annual')], 'children' => og_markup($c_2)])|noescape}
{/capture}
{=og_include('blocks/switcher.latte', ['p' => ['label' => og_get($v_billingLabels, ['label'])], 'children' => og_markup($c_3)])|noescape}
{capture $c_4}
{=og_text(og_get($v_billingLabels, ['save']))}
{/capture}
{=og_include('compose/Badge.latte', ['variant' => 'default', 'size' => 'default', 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'justify' => 'center', 'class' => 'flex-wrap', 'attrs' => og_attrs(['data-slot', 'billing']), 'children' => (string) $c_5])|noescape}
{/if}
{if og_t(og_eq(og_len($v_plans), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'layers', 'title' => og_get($v_labels, ['empty'])]])|noescape}
{else}
{capture $c_6}
{foreach og_l($v_plans) as $v_plan}
{=og_include('blocks/pricing-card.latte', ['p' => ['plan' => $v_plan, 'labels' => $v_labels, 'emphasis' => $v_emphasis, 'billing' => (og_t(og_eq($v_billing, 'annual')) ? 'annual' : 'monthly'), 'density' => (og_t(og_eq($v_density, 'compact')) ? 'compact' : 'default')]])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => og_s((og_t(og_eq($v_layout, 'stack')) ? '1' : og_fit_cols($v_cols, og_len($v_plans)))), 'class' => 'gap-4', 'attrs' => og_attrs(['data-slot', 'tiers']), 'children' => (string) $c_6])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'tone' => $v_tone, 'density' => $v_density, 'measure' => (og_t(og_eq($v_layout, 'stack')) ? 'md' : 'default'), 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_7)])|noescape}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdnnpx ui8kit add pricing-tiers{#- 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-tiers.json
A section with a heading and one PricingCard per plan; an empty state when there are none. Axes: layout (grid, stack), columns, emphasis, billing (off: no toggle; monthly or annual: a toggle with that choice selected, and the prices of that period), density, tone.
Props (p): id, title, plans, labels, billingLabels, layout, cols, emphasis, billing, tone, density, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_plans = og_def(p['plans'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set v_billingLabels = og_def(p['billingLabels'], none) -%}
{%- set v_layout = og_def(p['layout'], 'grid') -%}
{%- set v_cols = og_def(p['cols'], '1-3') -%}
{%- set v_emphasis = og_def(p['emphasis'], 'auto') -%}
{%- set v_billing = og_def(p['billing'], 'off') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_density = og_def(p['density'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_7 -%}
{%- if og_t(not (og_eq(v_billing, 'off'))) %}
{%- set c_5 -%}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_billingLabels, ['monthly'])) }}
{%- endset -%}
{{ og_include('blocks/switcher-item.html.j2', {'p': {'active': og_eq(v_billing, 'monthly')}, 'children': og_markup(c_1)}) }}
{%- set c_2 -%}
{{ og_text(og_get(v_billingLabels, ['annual'])) }}
{%- endset -%}
{{ og_include('blocks/switcher-item.html.j2', {'p': {'active': og_eq(v_billing, 'annual')}, 'children': og_markup(c_2)}) }}
{%- endset -%}
{{ og_include('blocks/switcher.html.j2', {'p': {'label': og_get(v_billingLabels, ['label'])}, 'children': og_markup(c_3)}) }}
{%- set c_4 -%}
{{ og_text(og_get(v_billingLabels, ['save'])) }}
{%- endset -%}
{{ og_include('compose/badge.html.j2', {'p': {'Variant': 'default', 'Size': 'default'}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Justify': 'center', 'Class': 'flex-wrap', 'Attrs': og_attrs(['data-slot', 'billing'])}, 'children': c_5}) }}
{%- endif %}
{%- if og_t(og_eq(og_len(v_plans), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'layers', 'title': og_get(v_labels, ['empty'])}}) }}
{%- else %}
{%- set c_6 -%}
{%- for v_plan in og_l(v_plans) %}
{{ og_include('blocks/pricing-card.html.j2', {'p': {'plan': v_plan, 'labels': v_labels, 'emphasis': v_emphasis, 'billing': ('annual' if og_t(og_eq(v_billing, 'annual')) else 'monthly'), 'density': ('compact' if og_t(og_eq(v_density, 'compact')) else 'default')}}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': og_s(('1' if og_t(og_eq(v_layout, 'stack')) else og_fit_cols(v_cols, og_len(v_plans)))), 'Class': 'gap-4', 'Attrs': og_attrs(['data-slot', 'tiers'])}, 'children': c_6}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'tone': v_tone, 'density': v_density, 'measure': ('md' if og_t(og_eq(v_layout, 'stack')) else 'default'), 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_7)}) }}
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 section with a heading and one PricingCard per plan; an empty state when there are none. Axes: layout (grid, stack), columns, emphasis, billing (off: no toggle; monthly or annual: a toggle with that choice selected, and the prices of that period), density, tone.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| plans (required) | Plan[] | - | |
| labels (required) | PricingCardLabels | - | |
| billingLabels (required) | BillingLabels | - | the toggle's name and choices; unused while `billing` is off |
| layout | "grid" | "stack" | "grid" | stack: one narrow column of cards |
| cols | "1-2" | "1-3" | "1-4" | "1-3" | |
| emphasis | "auto" | "off" | "auto" | |
| billing | "off" | "monthly" | "annual" | "off" | |
| tone | "default" | "muted" | "default" | |
| density | "roomy" | "default" | "compact" | "default" | |
| landmarkLabel | string | - | accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one |