Tailwind CSS pricing table: 3 examples with a no-JS yearly switch (v4)
Published 8 min read
On this page
A pricing table has one job: let someone find the plan that fits and see what it costs without doing sums. Most snippets get the cards right and then fall over on the details: the buttons don't line up because one plan has more features, the monthly and yearly switch needs a JavaScript framework, and the comparison table is a grid of check icons that a screen reader announces as nothing at all. This post has three pricing tables built with Tailwind CSS v4 that you can copy into a project, from simple plan cards to a full feature comparison.
Every example is plain HTML with Tailwind classes, and none of them needs JavaScript, including the billing switch. They assume Tailwind v4 with the default theme. The switch uses the has-checked: and group-has-[…] variants, which work in every current browser because they compile to the CSS :has() selector.
1. Three plan cards with a highlighted plan#
Use this for most products: three plans side by side on desktop, stacked on a phone, with the plan you want most people to pick marked as such. The cards stretch to the same height and the buttons sit at the bottom of each card, however long the feature lists are.
<section class="bg-white py-24">
<div class="mx-auto max-w-6xl px-6">
<div class="mx-auto max-w-2xl text-center">
<h2 class="text-3xl font-semibold tracking-tight text-gray-900 sm:text-4xl">Pricing</h2>
<p class="mt-4 text-lg text-gray-600">Start free. Upgrade when your team grows.</p>
</div>
<ul class="mt-16 grid gap-8 lg:grid-cols-3">
<li class="flex flex-col rounded-2xl border border-gray-200 p-8">
<h3 id="plan-starter" class="text-lg font-semibold text-gray-900">Starter</h3>
<p class="mt-2 text-sm text-gray-600">For one person trying it out.</p>
<p class="mt-6 flex items-baseline gap-x-1">
<span class="text-4xl font-semibold tracking-tight text-gray-900">$0</span>
<span class="text-sm text-gray-600">/month</span>
</p>
<ul class="mt-8 space-y-3 text-sm text-gray-700">
<li class="flex gap-x-3">
<svg class="size-5 shrink-0 text-indigo-600" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd"/>
</svg>
1 project
</li>
<li class="flex gap-x-3">
<svg class="size-5 shrink-0 text-indigo-600" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd"/>
</svg>
Community support
</li>
</ul>
<div class="mt-auto pt-8">
<a href="/signup?plan=starter" aria-describedby="plan-starter"
class="block rounded-md px-4 py-2.5 text-center text-sm font-semibold text-indigo-600 ring-1 ring-indigo-200 ring-inset hover:ring-indigo-300 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">
Start for free
</a>
</div>
</li>
<li class="relative flex flex-col rounded-2xl p-8 ring-2 ring-indigo-600">
<p class="absolute -top-3 left-8 rounded-full bg-indigo-600 px-3 py-0.5 text-xs font-semibold text-white">Most popular</p>
<h3 id="plan-team" class="text-lg font-semibold text-indigo-600">Team</h3>
<p class="mt-2 text-sm text-gray-600">For small teams shipping every week.</p>
<p class="mt-6 flex items-baseline gap-x-1">
<span class="text-4xl font-semibold tracking-tight text-gray-900">$12</span>
<span class="text-sm text-gray-600">/user/month</span>
</p>
<ul class="mt-8 space-y-3 text-sm text-gray-700">
<li class="flex gap-x-3">
<svg class="size-5 shrink-0 text-indigo-600" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd"/>
</svg>
10 projects
</li>
<li class="flex gap-x-3">
<svg class="size-5 shrink-0 text-indigo-600" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd"/>
</svg>
Custom domains
</li>
<li class="flex gap-x-3">
<svg class="size-5 shrink-0 text-indigo-600" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd"/>
</svg>
Email support
</li>
</ul>
<div class="mt-auto pt-8">
<a href="/signup?plan=team" aria-describedby="plan-team"
class="block rounded-md bg-indigo-600 px-4 py-2.5 text-center text-sm font-semibold text-white hover:bg-indigo-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">
Start a free trial
</a>
</div>
</li>
<li class="flex flex-col rounded-2xl border border-gray-200 p-8">
<h3 id="plan-business" class="text-lg font-semibold text-gray-900">Business</h3>
<p class="mt-2 text-sm text-gray-600">For larger teams with more to manage.</p>
<p class="mt-6 flex items-baseline gap-x-1">
<span class="text-4xl font-semibold tracking-tight text-gray-900">$24</span>
<span class="text-sm text-gray-600">/user/month</span>
</p>
<ul class="mt-8 space-y-3 text-sm text-gray-700">
<li class="flex gap-x-3">
<svg class="size-5 shrink-0 text-indigo-600" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd"/>
</svg>
Unlimited projects
</li>
<li class="flex gap-x-3">
<svg class="size-5 shrink-0 text-indigo-600" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd"/>
</svg>
Custom domains
</li>
<li class="flex gap-x-3">
<svg class="size-5 shrink-0 text-indigo-600" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd"/>
</svg>
Single sign-on
</li>
<li class="flex gap-x-3">
<svg class="size-5 shrink-0 text-indigo-600" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd"/>
</svg>
Priority support
</li>
</ul>
<div class="mt-auto pt-8">
<a href="/contact?plan=business" aria-describedby="plan-business"
class="block rounded-md px-4 py-2.5 text-center text-sm font-semibold text-indigo-600 ring-1 ring-indigo-200 ring-inset hover:ring-indigo-300 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600">
Talk to us
</a>
</div>
</li>
</ul>
</div>
</section>Key classes: each card is flex flex-col, and the button wrapper gets mt-auto, so it takes all free space above it and the buttons line up along the bottom even when one plan lists twice as many features. Grid items stretch to the height of the row by default, which is what makes the cards equal height in the first place. lg:grid-cols-3 keeps the cards stacked until 1024px; three columns of pricing at tablet width get too narrow for a price like $129 next to its period. The highlighted plan swaps the border for ring-2 ring-indigo-600, and the badge sits on the edge with absolute -top-3.
Each button has aria-describedby pointing at its plan name. A screen reader user tabbing through the page hears "Start a free trial, Team" instead of three buttons that could be for any plan.
2. Monthly and yearly switch without JavaScript#
Use this when you offer a discount for paying yearly. The usual approach is a toggle wired to JavaScript state. You don't need it: two radio buttons hold the state, and the CSS :has() selector shows the right price. It works before any script loads, it works with JavaScript off, and keyboard users get arrow-key navigation between the two options for free because that's how radio buttons behave.
<section class="group bg-white py-24">
<div class="mx-auto max-w-6xl px-6">
<fieldset class="mx-auto flex w-fit rounded-full bg-gray-100 p-1 text-sm font-medium">
<legend class="sr-only">Billing period</legend>
<label class="cursor-pointer rounded-full px-4 py-2 text-gray-600 has-checked:bg-white has-checked:text-gray-900 has-checked:shadow-sm has-focus-visible:outline-2 has-focus-visible:outline-indigo-600">
<input type="radio" name="billing" value="monthly" class="sr-only" checked>
Monthly
</label>
<label class="cursor-pointer rounded-full px-4 py-2 text-gray-600 has-checked:bg-white has-checked:text-gray-900 has-checked:shadow-sm has-focus-visible:outline-2 has-focus-visible:outline-indigo-600">
<input type="radio" name="billing" value="yearly" id="billing-yearly" class="sr-only">
Yearly <span class="text-indigo-600">2 months free</span>
</label>
</fieldset>
<ul class="mt-12 grid gap-8 lg:grid-cols-3">
<li class="flex flex-col rounded-2xl border border-gray-200 p-8">
<h3 class="text-lg font-semibold text-gray-900">Team</h3>
<p class="mt-6 flex items-baseline gap-x-1">
<span class="text-4xl font-semibold tracking-tight text-gray-900 group-has-[#billing-yearly:checked]:hidden">$12</span>
<span class="hidden text-4xl font-semibold tracking-tight text-gray-900 group-has-[#billing-yearly:checked]:inline">$10</span>
<span class="text-sm text-gray-600">/user/month</span>
</p>
<p class="mt-1 text-sm text-gray-600 group-has-[#billing-yearly:checked]:hidden">Billed monthly</p>
<p class="mt-1 hidden text-sm text-gray-600 group-has-[#billing-yearly:checked]:block">$120 per user, billed yearly</p>
<!-- features and button as in example 1 -->
</li>
</ul>
</div>
</section>Key classes: the switch is a <fieldset> of two labels, each wrapping a radio input hidden with sr-only. has-checked:bg-white styles the label whose input is checked, which is what makes it look like a segmented control. Because the real input is hidden, has-focus-visible:outline-2 puts the focus ring on the label instead, so keyboard users can still see where they are.
The prices react through group on the section and group-has-[#billing-yearly:checked] on each price. Read it as "when the section contains a checked element with the id billing-yearly". The monthly price is hidden in that state and the yearly one becomes inline. Since display: none also removes the hidden price from the accessibility tree, a screen reader reads only the price that is on screen. Two things to watch: the id has to be unique on the page, so give a second pricing section its own ids, and keep group off any element between the section and the prices, or the variant will look at the nearer group.
Say what the yearly price means. "$10 /user/month" on its own reads like a monthly price, so the line below it says what gets charged and when. If you write "2 months free", check the sum: $10 a month billed yearly is $120, against $144 for twelve months at $12, which is two monthly payments saved.
3. Feature comparison table#
Use this below the plan cards when your plans differ in more than four or five ways. The cards say what each plan is for; the table answers "does the plan I'm looking at include X". It's a real <table>, not a grid of divs, because the whole point is that every cell belongs to a row and a column.
<div class="mx-auto max-w-6xl overflow-x-auto px-6">
<table class="w-full min-w-2xl text-left text-sm">
<caption class="sr-only">Features by plan</caption>
<thead>
<tr>
<th scope="col" class="w-2/5 py-4"><span class="sr-only">Feature</span></th>
<th scope="col" class="px-4 py-4 font-semibold text-gray-900">Starter</th>
<th scope="col" class="px-4 py-4 font-semibold text-indigo-600">Team</th>
<th scope="col" class="px-4 py-4 font-semibold text-gray-900">Business</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="rowgroup" colspan="4" class="bg-gray-50 px-4 py-2 font-semibold text-gray-900">Projects</th>
</tr>
<tr class="border-t border-gray-200">
<th scope="row" class="sticky left-0 bg-white px-4 py-3 font-normal text-gray-700">Projects</th>
<td class="px-4 py-3 text-gray-700">1</td>
<td class="px-4 py-3 text-gray-700">10</td>
<td class="px-4 py-3 text-gray-700">Unlimited</td>
</tr>
<tr class="border-t border-gray-200">
<th scope="row" class="sticky left-0 bg-white px-4 py-3 font-normal text-gray-700">Custom domains</th>
<td class="px-4 py-3">
<span aria-hidden="true" class="text-gray-400">–</span>
<span class="sr-only">Not included</span>
</td>
<td class="px-4 py-3">
<svg class="size-5 text-indigo-600" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z" clip-rule="evenodd"/>
</svg>
<span class="sr-only">Included</span>
</td>
<td class="px-4 py-3">
<!-- same check icon and "Included" -->
</td>
</tr>
</tbody>
<tbody>
<tr>
<th scope="rowgroup" colspan="4" class="bg-gray-50 px-4 py-2 font-semibold text-gray-900">Support</th>
</tr>
<!-- rows as above -->
</tbody>
</table>
</div>Key classes: overflow-x-auto on the wrapper and min-w-2xl (42rem) on the table let it scroll sideways on a phone instead of squeezing four columns into 375px. sticky left-0 bg-white on the row headers keeps the feature names in view while the plans scroll past; the background is needed, or the cells slide visibly underneath. Each feature group is its own <tbody> with a scope="rowgroup" header, which is the table markup for "these rows belong together".
The cells are where most comparison tables go wrong. An icon with aria-hidden="true" and nothing else is an empty cell to a screen reader. Each cell here pairs the visible mark with sr-only text, "Included" or "Not included", so the table reads the same with or without sight. Use text instead of an icon whenever the answer isn't yes or no: "10", "Unlimited" or "Email, 1 business day" tell people more than a check mark.
Pricing table accessibility checklist#
- Use lists and tables for what they are. Plans are a
<ul>, features in a card are a<ul>, the comparison is a<table>withscopeon every header. Screen readers announce how many items or rows there are before reading them. - Name every button. Three "Get started" buttons are indistinguishable in a list of links.
aria-describedbypointing at the plan heading fixes it without changing the visible text. - Don't rely on color for the highlighted plan. A ring in your brand color is fine, but also say it in words, like the "Most popular" badge.
- Check the contrast of the small print. The period ("/month") and billing lines are small gray text. With Tailwind v4's default colors,
text-gray-600on white passes WCAG AA comfortably;text-gray-400does not. Our footer post has the numbers for the other grays. - Keep the switch a real form control. If you build the billing switch as a
<div>with a click handler, you have to add the role, the keyboard handling and the state announcement yourself. Radio buttons in a fieldset come with all of it.
If you'd rather start from a finished page than assemble one, Ledger's SaaS pricing page has plan cards, a monthly and yearly switch that works without JavaScript and a grouped comparison table with an FAQ, as part of a full marketing site in Astro or Next.js with Sanity.
FAQ#
How do I make a pricing table in Tailwind CSS?
Put the plans in a list with grid gap-8 lg:grid-cols-3, make each card flex flex-col with a border or ring, and give the button wrapper mt-auto so the buttons line up at the bottom. Add a highlighted plan with ring-2 and a badge. For plans that differ in many ways, add a comparison <table> below the cards.
Can I make a monthly and yearly pricing toggle without JavaScript?
Yes. Use two radio inputs in a fieldset as the switch, put group on the section that holds the switch and the prices, and show or hide each price with group-has-[#billing-yearly:checked]:hidden and group-has-[#billing-yearly:checked]:inline. It relies on the CSS :has() selector, which all current browsers support.
How do I make pricing cards the same height in Tailwind?
Grid items stretch to the height of their row by default, so cards in a grid are already the same height. To line up the buttons as well, make each card flex flex-col and put mt-auto on the button or its wrapper. The Tailwind docs on the has variant cover the has-* and group-has-* variants used in the billing switch.
