价格表 examples
三档价格区块,带有突出显示的推荐套餐、功能列表,以及月付或年付计费切换。
三列价格区块,带有突出显示的推荐档位、每个套餐的功能列表,以及月付或年付计费切换。在手机上按套餐的书写顺序堆叠为单列。
其中一个变体包含可用的月付/年付计费切换,同时提供 React 和纯 HTML 版本。其余变体是静态标记,这正是大多数网站真正需要的。
Three-tier pricing table
Starter, Pro, and Enterprise columns with an outlined, badged recommended plan. The recommended plan moves to the top on mobile.
export default function PricingTable() {
return (
<section className="mx-auto max-w-6xl px-4 py-12">
<div className="mb-10 text-center">
<h2 className="text-3xl font-bold text-gray-900">Simple pricing</h2>
<p className="mt-3 text-gray-600">Start free. Upgrade when your team grows.</p>
</div>
<div className="grid gap-6 lg:grid-cols-3">
<div className="relative rounded-xl border border-gray-200 bg-white p-6">
<h3 className="font-semibold text-gray-900">Starter</h3>
<p className="mt-1 text-sm text-gray-600">For side projects.</p>
<p className="mt-4"><span className="text-4xl font-bold text-gray-900">$0</span><span className="text-sm text-gray-600">/month</span></p>
<ul className="mt-6 space-y-3 text-sm text-gray-700">
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>1 project</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Community support</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>1 GB storage</span></li>
</ul>
<a href="#" className="mt-8 block rounded-md px-4 py-2 text-center text-sm font-medium border border-gray-300 text-gray-900 hover:bg-gray-50">Start free</a>
</div>
<div className="relative order-first rounded-xl border-2 border-gray-900 bg-white p-6 lg:order-none">
<span className="absolute -top-3 left-6 rounded-full bg-gray-900 px-3 py-1 text-xs font-medium text-white">Most popular</span>
<h3 className="font-semibold text-gray-900">Pro</h3>
<p className="mt-1 text-sm text-gray-600">For growing teams.</p>
<p className="mt-4"><span className="text-4xl font-bold text-gray-900">$24</span><span className="text-sm text-gray-600">/month</span></p>
<ul className="mt-6 space-y-3 text-sm text-gray-700">
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Unlimited projects</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Priority support</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>100 GB storage</span></li>
</ul>
<a href="#" className="mt-8 block rounded-md px-4 py-2 text-center text-sm font-medium bg-gray-900 text-white hover:bg-gray-700">Start trial</a>
</div>
<div className="relative rounded-xl border border-gray-200 bg-white p-6">
<h3 className="font-semibold text-gray-900">Enterprise</h3>
<p className="mt-1 text-sm text-gray-600">For larger organizations.</p>
<p className="mt-4"><span className="text-4xl font-bold text-gray-900">Custom</span></p>
<ul className="mt-6 space-y-3 text-sm text-gray-700">
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>SSO and audit logs</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Dedicated support</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Custom contracts</span></li>
</ul>
<a href="#" className="mt-8 block rounded-md px-4 py-2 text-center text-sm font-medium border border-gray-300 text-gray-900 hover:bg-gray-50">Contact sales</a>
</div>
</div>
</section>
);
}Pricing table with monthly and annual toggle
The same three tiers with a billing switch that updates prices in place. Buttons carry aria-pressed so the active period is announced.
"use client";
import { useState } from "react";
const plans = [
{
name: "Starter",
tagline: "For side projects.",
monthly: 0,
annual: 0,
features: ["1 project", "Community support", "1 GB storage"],
cta: "Start free",
featured: false,
},
{
name: "Pro",
tagline: "For growing teams.",
monthly: 24,
annual: 19,
features: ["Unlimited projects", "Priority support", "100 GB storage"],
cta: "Start trial",
featured: true,
},
{
name: "Enterprise",
tagline: "For larger organizations.",
monthly: null,
annual: null,
features: ["SSO and audit logs", "Dedicated support", "Custom contracts"],
cta: "Contact sales",
featured: false,
},
];
export default function PricingTable() {
const [annual, setAnnual] = useState(false);
const tab = "rounded-md px-4 py-1.5 text-sm font-medium ";
return (
<section className="mx-auto max-w-6xl px-4 py-12">
<div className="mb-10 text-center">
<h2 className="text-3xl font-bold text-gray-900">Simple pricing</h2>
<p className="mt-3 text-gray-600">Start free. Upgrade when your team grows.</p>
<div
className="mt-6 inline-flex rounded-lg border border-gray-200 p-1"
role="group"
aria-label="Billing period"
>
<button
type="button"
onClick={() => setAnnual(false)}
aria-pressed={!annual}
className={tab + (!annual ? "bg-gray-900 text-white" : "text-gray-600")}
>
Monthly
</button>
<button
type="button"
onClick={() => setAnnual(true)}
aria-pressed={annual}
className={tab + (annual ? "bg-gray-900 text-white" : "text-gray-600")}
>
Annual
</button>
</div>
</div>
<div className="grid gap-6 lg:grid-cols-3">
{plans.map((plan) => {
const price = annual ? plan.annual : plan.monthly;
return (
<div
key={plan.name}
className={
"relative rounded-xl bg-white p-6 " +
(plan.featured
? "order-first border-2 border-gray-900 lg:order-none"
: "border border-gray-200")
}
>
{plan.featured && (
<span className="absolute -top-3 left-6 rounded-full bg-gray-900 px-3 py-1 text-xs font-medium text-white">
Most popular
</span>
)}
<h3 className="font-semibold text-gray-900">{plan.name}</h3>
<p className="mt-1 text-sm text-gray-600">{plan.tagline}</p>
<p className="mt-4">
<span className="text-4xl font-bold text-gray-900">
{price === null ? "Custom" : "$" + price}
</span>
{price !== null && <span className="text-sm text-gray-600">/month</span>}
</p>
<ul className="mt-6 space-y-3 text-sm text-gray-700">
{plan.features.map((feature) => (
<li key={feature}>{feature}</li>
))}
</ul>
<a
href="#"
className={
"mt-8 block rounded-md px-4 py-2 text-center text-sm font-medium " +
(plan.featured
? "bg-gray-900 text-white hover:bg-gray-700"
: "border border-gray-300 text-gray-900 hover:bg-gray-50")
}
>
{plan.cta}
</a>
</div>
);
})}
</div>
</section>
);
}Two-tier pricing table
Free next to paid. Fewer options convert better when the plans are genuinely different rather than incrementally larger.
export default function TwoTierPricing() {
return (
<section className="mx-auto max-w-3xl px-4 py-12">
<div className="mb-10 text-center">
<h2 className="text-3xl font-bold text-gray-900">Two plans. No surprises.</h2>
<p className="mt-3 text-gray-600">Try it free, then pay only when you need more.</p>
</div>
<div className="grid gap-6 md:grid-cols-2">
<div className="relative rounded-xl border border-gray-200 bg-white p-6">
<h3 className="font-semibold text-gray-900">Starter</h3>
<p className="mt-1 text-sm text-gray-600">For side projects.</p>
<p className="mt-4"><span className="text-4xl font-bold text-gray-900">$0</span><span className="text-sm text-gray-600">/month</span></p>
<ul className="mt-6 space-y-3 text-sm text-gray-700">
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>1 project</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Community support</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>1 GB storage</span></li>
</ul>
<a href="#" className="mt-8 block rounded-md px-4 py-2 text-center text-sm font-medium border border-gray-300 text-gray-900 hover:bg-gray-50">Start free</a>
</div>
<div className="relative order-first rounded-xl border-2 border-gray-900 bg-white p-6 lg:order-none">
<span className="absolute -top-3 left-6 rounded-full bg-gray-900 px-3 py-1 text-xs font-medium text-white">Most popular</span>
<h3 className="font-semibold text-gray-900">Pro</h3>
<p className="mt-1 text-sm text-gray-600">For growing teams.</p>
<p className="mt-4"><span className="text-4xl font-bold text-gray-900">$24</span><span className="text-sm text-gray-600">/month</span></p>
<ul className="mt-6 space-y-3 text-sm text-gray-700">
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Unlimited projects</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Priority support</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>100 GB storage</span></li>
</ul>
<a href="#" className="mt-8 block rounded-md px-4 py-2 text-center text-sm font-medium bg-gray-900 text-white hover:bg-gray-700">Start trial</a>
</div>
</div>
</section>
);
}Pricing comparison table
A feature-by-feature table with checks and dashes. Use it when plans share most features and differ in limits. Scrolls sideways on narrow screens.
export default function PricingComparison() {
return (
<section className="mx-auto max-w-4xl px-4 py-12">
<h2 className="text-center text-3xl font-bold text-gray-900">Compare plans</h2>
<div className="mt-8 overflow-x-auto rounded-xl border border-gray-200">
<table className="w-full min-w-[32rem] text-left text-sm">
<thead className="bg-gray-50 text-gray-900">
<tr>
<th scope="col" className="px-4 py-3 font-semibold">Feature</th>
<th scope="col" className="px-4 py-3 text-center font-semibold">Starter</th>
<th scope="col" className="px-4 py-3 text-center font-semibold">Pro</th>
<th scope="col" className="px-4 py-3 text-center font-semibold">Enterprise</th>
</tr>
</thead>
<tbody className="divide-y divide-gray-200 text-gray-700">
<tr>
<th scope="row" className="px-4 py-3 font-medium text-gray-900">Projects</th>
<td className="px-4 py-3 text-center">1</td>
<td className="px-4 py-3 text-center">Unlimited</td>
<td className="px-4 py-3 text-center">Unlimited</td>
</tr>
<tr>
<th scope="row" className="px-4 py-3 font-medium text-gray-900">Storage</th>
<td className="px-4 py-3 text-center">1 GB</td>
<td className="px-4 py-3 text-center">100 GB</td>
<td className="px-4 py-3 text-center">Custom</td>
</tr>
<tr>
<th scope="row" className="px-4 py-3 font-medium text-gray-900">Community support</th>
<td className="px-4 py-3 text-center"><svg className="mx-auto h-5 w-5 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span className="sr-only">Included</span></td>
<td className="px-4 py-3 text-center"><svg className="mx-auto h-5 w-5 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span className="sr-only">Included</span></td>
<td className="px-4 py-3 text-center"><svg className="mx-auto h-5 w-5 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span className="sr-only">Included</span></td>
</tr>
<tr>
<th scope="row" className="px-4 py-3 font-medium text-gray-900">Priority support</th>
<td className="px-4 py-3 text-center"><span aria-hidden="true" className="text-gray-400">-</span><span className="sr-only">Not included</span></td>
<td className="px-4 py-3 text-center"><svg className="mx-auto h-5 w-5 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span className="sr-only">Included</span></td>
<td className="px-4 py-3 text-center"><svg className="mx-auto h-5 w-5 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span className="sr-only">Included</span></td>
</tr>
<tr>
<th scope="row" className="px-4 py-3 font-medium text-gray-900">SSO and audit logs</th>
<td className="px-4 py-3 text-center"><span aria-hidden="true" className="text-gray-400">-</span><span className="sr-only">Not included</span></td>
<td className="px-4 py-3 text-center"><span aria-hidden="true" className="text-gray-400">-</span><span className="sr-only">Not included</span></td>
<td className="px-4 py-3 text-center"><svg className="mx-auto h-5 w-5 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span className="sr-only">Included</span></td>
</tr>
<tr>
<th scope="row" className="px-4 py-3 font-medium text-gray-900">Custom contracts</th>
<td className="px-4 py-3 text-center"><span aria-hidden="true" className="text-gray-400">-</span><span className="sr-only">Not included</span></td>
<td className="px-4 py-3 text-center"><span aria-hidden="true" className="text-gray-400">-</span><span className="sr-only">Not included</span></td>
<td className="px-4 py-3 text-center"><svg className="mx-auto h-5 w-5 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span className="sr-only">Included</span></td>
</tr>
</tbody>
</table>
</div>
</section>
);
}Pricing table with elevated featured plan
The recommended plan is lifted with a shadow and extra height instead of a heavier border, so emphasis comes from depth.
export default function ElevatedPricing() {
return (
<section className="mx-auto max-w-6xl px-4 py-12">
<div className="mb-10 text-center">
<h2 className="text-3xl font-bold text-gray-900">Pricing that scales</h2>
<p className="mt-3 text-gray-600">The Pro plan covers most teams.</p>
</div>
<div className="grid gap-6 lg:grid-cols-3 lg:items-center">
<div className="relative rounded-xl border border-gray-200 bg-white p-6">
<h3 className="font-semibold text-gray-900">Starter</h3>
<p className="mt-1 text-sm text-gray-600">For side projects.</p>
<p className="mt-4"><span className="text-4xl font-bold text-gray-900">$0</span><span className="text-sm text-gray-600">/month</span></p>
<ul className="mt-6 space-y-3 text-sm text-gray-700">
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>1 project</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Community support</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>1 GB storage</span></li>
</ul>
<a href="#" className="mt-8 block rounded-md px-4 py-2 text-center text-sm font-medium border border-gray-300 text-gray-900 hover:bg-gray-50">Start free</a>
</div>
<div className="relative order-first rounded-xl bg-white p-6 shadow-xl ring-1 ring-gray-900/10 lg:order-none lg:-my-4 lg:py-10">
<span className="absolute -top-3 left-6 rounded-full bg-gray-900 px-3 py-1 text-xs font-medium text-white">Most popular</span>
<h3 className="font-semibold text-gray-900">Pro</h3>
<p className="mt-1 text-sm text-gray-600">For growing teams.</p>
<p className="mt-4"><span className="text-4xl font-bold text-gray-900">$24</span><span className="text-sm text-gray-600">/month</span></p>
<ul className="mt-6 space-y-3 text-sm text-gray-700">
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Unlimited projects</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Priority support</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>100 GB storage</span></li>
</ul>
<a href="#" className="mt-8 block rounded-md px-4 py-2 text-center text-sm font-medium bg-gray-900 text-white hover:bg-gray-700">Start trial</a>
</div>
<div className="relative rounded-xl border border-gray-200 bg-white p-6">
<h3 className="font-semibold text-gray-900">Enterprise</h3>
<p className="mt-1 text-sm text-gray-600">For larger organizations.</p>
<p className="mt-4"><span className="text-4xl font-bold text-gray-900">Custom</span></p>
<ul className="mt-6 space-y-3 text-sm text-gray-700">
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>SSO and audit logs</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Dedicated support</span></li>
<li className="flex gap-2"><svg className="h-4 w-4 shrink-0 text-gray-900" fill="none" stroke="currentColor" strokeWidth="1.5" viewBox="0 0 24 24" aria-hidden="true"><path strokeLinecap="round" strokeLinejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg><span>Custom contracts</span></li>
</ul>
<a href="#" className="mt-8 block rounded-md px-4 py-2 text-center text-sm font-medium border border-gray-300 text-gray-900 hover:bg-gray-50">Contact sales</a>
</div>
</div>
</section>
);
}What is a 价格表?
价格表把产品的各个套餐并排摆放,让访客一眼就能比较。它是披着营销区块外衣的比较界面:视觉上的任务是看起来整洁,真正的任务是让各档位之间的差异足够快地被读懂,使人选定一个,而不是离开去思考。
这种结构几乎是通用的,因为它有效。每一列包含套餐名称、一句说明适合谁的话、价格、包含内容的列表,以及一个操作。通常会突出一个推荐档位,这听起来像是设计上的点缀,实际上却在发挥作用--面对三个相似的选项而没有指引时,人们往往默认选中间那个,或者一个也不选,而明确的推荐会消除这种犹豫。
计费切换是唯一真正具有交互性的部分,它存在的原因是年付通常有折扣。在年付时显示折算后的月均价格是标准做法,但最好在标签中清楚说明收取的是哪个数字以及何时收取,因为显示的数字与实际从账户中扣除的金额之间的差距,正是价格页面失去信任的地方。
这类区块最常在断点处出问题。三列功能列表在手机上变成三个堆叠的块,而在桌面视线中被精心安排在中间的推荐套餐,最终被埋在另外两个之间,位于大多数手机访客不会滑过的折叠线之下。让推荐套餐在手机上排在最前面只需改一个类,很容易被忽略,错过的代价却很高。
Anatomy
- 区块标题
- 列上方的标题和辅助说明。辅助说明保持一句话,说明这些套餐面向谁,而不是销售话术段落。
- 计费切换
- 两个带有 aria-pressed 的按钮,指示当前周期。使用按钮而非开关,因为选择的是两个有名称的选项,而不是开与关。
- 套餐卡片
- 每个档位一列,包含名称、简介、价格、功能列表和操作。所有卡片共用相同的内部间距,使价格和按钮在各列之间对齐。
- 推荐徽章
- 推荐套餐上绝对定位的标签,偏移到卡片上边缘之上,读起来像是附着在卡片上而不是包含在其中。
- 功能列表
- 每个套餐一个 ul。尽可能让各档位的条目数量相同,否则各列的结束高度不同,按钮就无法对齐。
- 套餐操作
- 每张卡片底部的按钮或链接。推荐套餐使用实心样式,其他使用描边样式,让视觉权重与预期路径一致。
How to Use
- 1
复制你需要的版本
想要可用的计费切换就选 React 版本,想要仅含月付的静态表格就选 HTML 版本。
- 2
编辑 plans 数组
替换名称、简介、价格和功能。featured 标志控制哪一列获得边框、徽章和实心按钮--只给一个套餐设置它。
- 3
设置年付折扣
annual 字段是按年付费时的月均价格,而不是全年总价。请让计费标签明确说明收取的是哪个数字。
- 4
修正手机上的顺序
给推荐卡片添加 order-first lg:order-none,使推荐套餐在手机上显示在顶部,在桌面上回到中间。
- 5
接入各操作
把每个套餐的链接指向你的注册流程,并在查询字符串或路径中带上套餐标识,使选择能够延续,而不必再次询问。
Features
可用的计费切换
月付和年付价格无需刷新页面即可切换,每个按钮上都有 aria-pressed,使当前周期被播报出来,而不只是显示出来。
数据驱动的列
整个区块由一个 plans 数组渲染,因此增删档位只是数据更改,而不是标记更改。
推荐套餐样式
一个布尔值驱动更粗的边框、徽章和实心按钮,使强调保持一致,而不是逐个元素手动应用。
跨列对齐
统一的内部间距让价格、列表和按钮处于相同的水平线上,这才使表格可扫读,而不只是整齐。
自定义价格处理
价格为 null 时显示为 Custom,并省略“每月”后缀,因此企业档位不需要单独的标记。
Common Uses
SaaS 价格页面
订阅产品的标准三档布局,免费或入门套餐位于低端,联系销售的档位位于顶端。
服务和代理机构套餐
展示范围固定的套餐,其差异在于交付成果而不是使用限额,把中间套餐作为预期的默认选项。
会员和课程档位
为社区、课程或订阅通讯列出访问级别,其中年付有可观的折扣。
对比付费套餐与免费套餐
两列版本,把免费档位放在付费档位旁边,以对比而不是争论的方式说明升级的理由。
Accessibility
- 计费切换使用带 aria-pressed 的按钮,而不是样式化为开关的复选框,因为选择的是两个有名称的周期,而不是二元的开或关。
- 套餐名称是真正的标题,因此屏幕阅读器用户可以通过标题导航在套餐之间移动,而不必听完每个功能列表。
- 功能列表是 ul 元素,因此其长度会在朗读条目之前被播报,听者可以决定是否跳过。
- 推荐徽章是卡片内的纯文本,因此会在原位被朗读,而不是一个永远不会到达辅助技术的装饰元素。
- 切换时价格的变化发生在正常的文档流中。如果需要播报这一变化,请把价格包在 aria-live 设为 polite 的容器中。
- 每个操作链接的文字或 aria-label 中都带有套餐名称,因此脱离上下文朗读的链接列表不会由三个相同的“开始试用”条目组成。
Customization
- 通过替换推荐边框、徽章和按钮上的 gray-900 值来更改强调色。这三者应当始终一起变化,否则强调效果会割裂。
- 要切换为对比布局,可以把每个套餐的列表替换为卡片下方的单个表格,当各套餐共享功能而仅在限额上不同时,这样更合适。
- 在年付切换旁添加节省提示。保持真实--使用与实际差额相符的百分比,而不是向上取整的营销数字。
- 如果描边对你的设计来说太抢眼,可以用 shadow-lg 和 lg:-mt-4 为推荐卡片增加层次感,代替更粗的边框。
- 超过三个档位时,在手机上改用可横向滚动的行,而不是更长的堆叠,因为四张堆叠的卡片会把最后一张推到折叠线之下很远。
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| plans * | Plan[] | - | 要渲染的档位。每个档位包含名称、简介、月付和年付价格、功能列表,以及控制突出显示效果的 featured 标志。 |
| defaultAnnual | boolean | false | 切换开关初始所在的计费周期。从年付开始会显示更低的标题数字,有些团队喜欢这样,有些则认为这具有误导性--请审慎选择。 |
Why Use These 价格表s?
计费切换是真正可用的状态,而不是某一种状态的静态截图。大多数复制粘贴式价格区块要么省略它,要么把它当作无功能的装饰,必须先接入才能上线。
各列由数据数组渲染,因此改价格只需一次编辑,而不是在几乎相同的三段标记中同时修改三处--价格表正是这样在几轮更新之后变得不一致的。
手机上的排序问题被记录在案,而不是留作意外。它是价格区块中最常见的缺陷,而修复只需一个类。
Tips
- 用 order-first lg:order-none 让推荐套餐在手机上排在最前。它的居中位置只在宽屏上有帮助;堆叠时,它只是被滑过的第二个内容。
- 在你能如实做到的情况下,让各套餐的功能列表长度一致。长度不一的列表会让按钮处于不同高度,即使没人说得出原因,也会显得草率。
- 每个功能以各档位之间的差异开头,而不是以所有档位都包含的内容开头。三列都以“SSL 证书”开头,浪费了阅读量最大的那一行。
- 明确说明年付数字是月均价还是全年总价。这是价格页面最常见的困惑来源。
- 除非套餐确实不同,否则避免增加第四个档位。每多一列都会让其他列变窄,并增加一个决定而不是减少一个。
- 如果某个套餐有使用限额,请写在列表中而不是脚注里。注册后才发现的限额,就是一个等着发生的退款请求。