Pricing Table
Compare plan features and monthly or annual billing in one view.
Make it yours.
Install the editable source and its dependencies into your React + Tailwind project.
Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/pricing-table.jsonUse it
Scroll horizontally for long lines
"use client";
import {PricingTable} from '@/components/jez-ui/blocks/pricing-table';
export default function Example(){
return <><PricingTable/></>;
}Props & types
Scroll horizontally for long lines
{
className?: string;
href?: string;
}Source
View 4 source files
registry/blocks/pricing-table.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { Check, ArrowUpRight } from "lucide-react";
import { cn } from "../ui/utils";
import { Button } from "../ui/button";
import { Switch } from "../ui/switch";
const plans = [
{
name: "Personal",
price: 0,
text: "For your own projects and the occasional collaborator.",
features: [
"3 active projects",
"1 guest",
"7-day version history",
"Community support",
],
},
{
name: "Team",
price: 15,
text: "For a team planning, reviewing, and shipping together.",
features: [
"Unlimited projects",
"10 guests",
"90-day version history",
"Email support",
],
},
{
name: "Studio",
price: 35,
text: "For several teams and a longer view of the work.",
features: [
"Unlimited projects",
"Unlimited guests",
"Unlimited version history",
"Priority support",
],
},
];
export function PricingTable({
className,
href = "#contact",
}: {
className?: string;
href?: string;
}) {
const [annual, setAnnual] = React.useState(false);
return (
<section className={cn("py-12 md:py-16", className)}>
<div className="mb-10 flex flex-wrap items-end justify-between gap-7">
<div>
<h2 className="text-4xl md:text-5xl">Room for your team.</h2>
<p className="mt-4 max-w-md text-sm leading-relaxed text-muted-foreground">
Start with a project. Choose a plan around the people and the
history you need to keep.
</p>
</div>
<label className="flex items-center gap-3 text-xs">
<Switch checked={annual} onCheckedChange={setAnnual} />
Annual billing
<span className="rounded-full bg-primary/10 px-2 py-1 font-medium text-primary">
Save 20%
</span>
</label>
</div>
<div className="grid overflow-hidden rounded-xl border border-border md:grid-cols-3">
{plans.map((p, i) => (
<article
key={p.name}
className={cn(
"flex flex-col border-b border-border p-6 last:border-0 md:border-r md:border-b-0 md:p-8",
i === 1 && "bg-muted/55",
)}
>
<div className="flex items-center justify-between">
<h3 className="text-lg font-medium">{p.name}</h3>
{i === 1 && (
<span className="text-[11px] text-primary">For teams</span>
)}
</div>
<p className="mb-6 mt-3 min-h-12 text-sm leading-relaxed text-muted-foreground">
{p.text}
</p>
<p className="text-5xl tabular-nums" aria-live="polite">
£{annual ? p.price * 0.8 : p.price}
<span className="ml-1 text-xs text-muted-foreground">
/ month
</span>
</p>
<p className="mb-7 mt-2 text-xs text-muted-foreground">
{p.price === 0
? "Free, with no billing details"
: annual
? `£${p.price * 0.8 * 12} billed annually`
: "Billed monthly"}
</p>
<Button
asChild
variant={i === 1 ? "primary" : "outline"}
className="w-full justify-between"
>
<a href={href}>
Choose {p.name}
<ArrowUpRight size={15} />
</a>
</Button>
<ul className="mt-7 grid gap-4 border-t border-border pt-6 text-xs">
{p.features.map((f) => (
<li key={f} className="flex items-center gap-2.5">
<Check size={14} className="text-primary" />
{f}
</li>
))}
</ul>
</article>
))}
</div>
<p className="mt-4 text-xs text-muted-foreground">
Illustrative pricing. No purchase is processed.
</p>
</section>
);
}
registry/ui/utils.ts
Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
return twMerge(clsx(values));
}
registry/ui/button.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { Slot } from "radix-ui";
import { LoaderCircle } from "lucide-react";
import { cn } from "./utils";
export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
variant?: "primary" | "secondary" | "outline" | "ghost" | "danger";
size?: "sm" | "md" | "lg";
loading?: boolean;
asChild?: boolean;
};
export function Button({
variant = "primary",
size = "md",
loading,
asChild,
className,
children,
disabled,
...props
}: ButtonProps) {
const Comp = asChild ? Slot.Root : "button";
return (
<Comp
type={asChild ? undefined : "button"}
disabled={asChild ? undefined : disabled || loading}
aria-disabled={disabled || loading || undefined}
aria-busy={loading || undefined}
className={cn(
"relative inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-lg border border-transparent text-sm font-medium leading-none transition-[background-color,border-color,box-shadow,transform] duration-150 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:scale-[.98] disabled:pointer-events-none disabled:opacity-45 aria-disabled:pointer-events-none [&_svg]:shrink-0",
{
"bg-primary text-primary-foreground shadow-[inset_0_1px_0_#ffffff26,0_1px_2px_#00000012] hover:bg-primary/90":
variant === "primary",
"border-border/60 bg-muted text-foreground hover:bg-muted/70":
variant === "secondary",
"border-border bg-background text-foreground shadow-sm hover:bg-muted/60":
variant === "outline",
"text-muted-foreground hover:bg-muted hover:text-foreground":
variant === "ghost",
"bg-danger text-danger-foreground hover:bg-danger/90":
variant === "danger",
},
{
"h-8 px-3 text-xs": size === "sm",
"h-10 px-4": size === "md",
"h-12 px-6": size === "lg",
},
className,
)}
{...props}
>
{asChild ? (
children
) : (
<>
<span
className={cn(
"inline-flex min-w-0 flex-1 items-center justify-center gap-2",
loading && "invisible",
)}
>
{children}
</span>
{loading && (
<LoaderCircle
aria-hidden="true"
className="absolute size-4 animate-spin motion-reduce:animate-none"
/>
)}
</>
)}
</Comp>
);
}
registry/ui/switch.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { Switch as P } from "radix-ui";
import { cn } from "./utils";
export function Switch({
className,
...props
}: React.ComponentProps<typeof P.Root>) {
return (
<P.Root
className={cn(
"relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border border-border bg-muted p-[2px] align-middle transition-colors data-[state=checked]:border-primary data-[state=checked]:bg-primary disabled:opacity-50",
className,
)}
{...props}
>
<P.Thumb className="pointer-events-none block size-[18px] rounded-full bg-white shadow-sm transition-transform duration-200 ease-out data-[state=checked]:translate-x-5" />
</P.Root>
);
}
Dependencies
lucide-react@0.577.0 · clsx@2.1.1 · tailwind-merge@3.5.0 · radix-ui@1.6.7
Accessibility & behaviour
Provide meaningful labels and preserve keyboard focus styles. Check contrast when customising theme colours.
Read the accessibility and performance guide →