Library MCP Setup About Template Factory ↗
← Library / Pricing UI SDK Agentic

Pricing Tier Grid

Three-tier SaaS pricing grid built on UI SDK SegmentedControl and Button primitives so humans and AI agents can toggle billing periods and trigger confirmed checkout.

Install UI SDK & packages

npm install @ui-sdk/react @ui-sdk/core lucide-react

Give your agent the UI SDK skill

npx skills add vercel-labs/ui --skill ui-sdk

UI SDK entries: @ui-sdk/react/field @ui-sdk/react/segmented-control @ui-sdk/react/button
"use client";

import * as React from "react";
import { Check } from "lucide-react";
import { Button } from "@ui-sdk/react/button";
import { Field, FieldLabel } from "@ui-sdk/react/field";
import {
  SegmentedControl,
  SegmentedControlIndicator,
  SegmentedControlItem,
} from "@ui-sdk/react/segmented-control";

export interface PricingTier {
  id: string;
  name: string;
  monthly: number;
  annual: number;
  summary: string;
  features: string[];
  popular?: boolean;
}

const DEFAULT_TIERS: PricingTier[] = [
  {
    id: "starter",
    name: "Starter",
    monthly: 19,
    annual: 15,
    summary: "For solo builders shipping their first app.",
    features: ["Up to 3 active projects", "All core UI SDK blocks", "Community support"],
  },
  {
    id: "pro",
    name: "Pro",
    monthly: 49,
    annual: 39,
    summary: "Everything needed to ship fast every week.",
    features: ["Unlimited projects & exports", "Full agentic MCP catalog", "Priority email support", "Commercial license"],
    popular: true,
  },
  {
    id: "team",
    name: "Team",
    monthly: 129,
    annual: 99,
    summary: "Shared design systems for growing product teams.",
    features: ["Up to 10 seats included", "Private custom blocks", "Shared WebMCP guardrails", "Dedicated Slack channel"],
  },
];

export function PricingTierGrid({
  tiers = DEFAULT_TIERS,
  onSelectTier,
}: {
  tiers?: PricingTier[];
  onSelectTier?: (tier: PricingTier, billing: "monthly" | "annual") => void;
}) {
  const [billing, setBilling] = React.useState<"monthly" | "annual">("annual");

  return (
    <section className="mx-auto w-full max-w-5xl px-4 py-12">
      <div className="mb-10 flex flex-col items-center gap-3 text-center">
        <Field className="flex flex-col items-center gap-2">
          <FieldLabel className="sr-only">Billing period</FieldLabel>
          <SegmentedControl
            value={billing}
            onValueChange={(next) => {
              if (next === "monthly" || next === "annual") setBilling(next);
            }}
            className="relative inline-grid grid-cols-2 rounded-full border border-border bg-card p-1 text-sm"
          >
            <SegmentedControlIndicator className="rounded-full bg-sky-400 transition-transform duration-150" />
            <SegmentedControlItem
              value="monthly"
              className="relative z-10 cursor-pointer rounded-full px-4 py-1.5 font-semibold text-muted-foreground transition-colors data-checked:text-slate-950"
            >
              Monthly
            </SegmentedControlItem>
            <SegmentedControlItem
              value="annual"
              className="relative z-10 cursor-pointer rounded-full px-4 py-1.5 font-semibold text-muted-foreground transition-colors data-checked:text-slate-950"
            >
              Annual (Save 20%)
            </SegmentedControlItem>
          </SegmentedControl>
        </Field>
      </div>

      <div className="grid gap-6 md:grid-cols-3">
        {tiers.map((tier) => {
          const price = billing === "annual" ? tier.annual : tier.monthly;
          return (
            <div
              key={tier.id}
              className={
                tier.popular
                  ? "relative flex flex-col justify-between rounded-2xl border-2 border-sky-400/70 bg-card p-6 shadow-xl shadow-sky-500/10"
                  : "flex flex-col justify-between rounded-2xl border border-border bg-card/70 p-6"
              }
            >
              {tier.popular && (
                <span className="absolute -top-3 right-5 rounded-full bg-sky-400 px-3 py-0.5 text-xs font-bold text-slate-950">
                  Most Popular
                </span>
              )}

              <div>
                <h3 className="text-lg font-bold text-foreground">{tier.name}</h3>
                <p className="mt-1 text-sm text-muted-foreground">{tier.summary}</p>
                <div className="mt-5 flex items-baseline gap-1">
                  <span className="text-4xl font-extrabold tracking-tight text-foreground">${price}</span>
                  <span className="text-sm text-muted-foreground">/mo</span>
                </div>
                <ul className="mt-6 space-y-2.5 text-sm text-muted-foreground">
                  {tier.features.map((feat) => (
                    <li key={feat} className="flex items-center gap-2.5">
                      <Check className="h-4 w-4 shrink-0 text-sky-400" aria-hidden="true" />
                      <span>{feat}</span>
                    </li>
                  ))}
                </ul>
              </div>

              <div className="mt-7">
                <Button
                  data-agent-confirm={`Starts checkout for the ${tier.name} plan ($${price}/mo, ${billing})`}
                  onClick={() => onSelectTier?.(tier, billing)}
                  className={
                    tier.popular
                      ? "inline-flex w-full cursor-pointer items-center justify-center rounded-xl bg-sky-400 px-4 py-2.5 text-sm font-bold text-slate-950 transition hover:bg-sky-300"
                      : "inline-flex w-full cursor-pointer items-center justify-center rounded-xl border border-border bg-secondary px-4 py-2.5 text-sm font-semibold text-foreground transition hover:border-sky-400/50"
                  }
                >
                  Choose {tier.name} plan
                </Button>
              </div>
            </div>
          );
        })}
      </div>
    </section>
  );
}

export default PricingTierGrid;