Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Grouped Comparison Table Pricing Block for React

A long comparison you fold by group: four API-gateway plans over thirty-four features in five groups, each group a header row you press to open, with one open at first and per-plan counts when closed.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Compare dense feature lists without a wall of rows using this grouped comparison table, for React with Base UI. A compact header holds the headline and one sentence on the left and an Expand all Button on the right. Below it one Table spans the page column between its rails, drawn by Guides with a + mark on each corner. Its first row is the four plans: names, who each is for, monthly prices and Shine Button calls to action, with a Best value Badge, a light tint and the only primary button on the Business column. Thirty-four features sit in five groups, Traffic and limits, Routing and transforms, Security, Observability and Support. Each group is a header row with its name, its feature count and a chevron, and pressing it opens or closes the rows; only the first group starts open. A closed group still answers the question people ask first: its header shows, for every plan, how many of the group's features that plan includes ("2 of 8", "8 of 8"). Below the md breakpoint a Segment Group picks one plan, and the table keeps the feature names beside that plan's column. Built with Table, Button, Segment Group, Badge, Shine Button, Guides and Lucide icons, with CSS transitions only. For API and infrastructure pricing, feature-dense SaaS plans and enterprise software comparisons.

FAQ

How do I change the plans, groups and limits?

Edit the two arrays at the top of the file. PLANS holds each column's name, description, monthly price (null shows "Custom"), call to action with its href, and whether it's popular, with its badge. GROUPS holds the categories, each with its features: a feature has a name and a value per plan id, true for a check, false for a dash, or text for a limit such as "100M". The counts in the headers are computed from those values (a limit counts as included), so they never drift. Add a plan and TypeScript points at every feature that still needs a value for it.

How do I change which groups start open?

The first useState holds the names of the open groups: start it with [GROUPS[0].name] for one, [] for all closed, or GROUPS.map((group) => group.name) for all open. The Expand all button reads "Collapse all" once every group is open, and the group buttons keep working in any state. Keep one group open when the table is long: a page that starts with five closed rows says nothing, and one that starts with a single open group shows what the rows look like.

How do I send the calls to action to checkout?

Each call to action is a link: point each plan's href at your signup or checkout with the plan in the address (/checkout?plan=business), and Enterprise's at your sales form. For usage-based API pricing, your billing provider's metered prices take it from there. The link is render={<a href={plan.href} />} on ShineButton, with nativeButton={false}.

Is the grouped table accessible to screen readers and keyboards?

Each group header holds a real button, with aria-expanded saying whether its rows are shown, so Tab reaches it and Enter or Space toggles it; the rows of a closed group aren't in the page at all. Plan names are column headers, feature names are row headers, and every check and dash carries hidden text. The counts in the header are read in full ("Developer includes 4 of 8 Security features"), prices are read with their period and each call to action says which plan it's for.

How does the table work on a phone?

A plan switch (a radio group) appears over the table with the best value plan selected, and the table shows the feature names beside that one plan's column, so the call to action is in the first screen and nothing scrolls sideways. The group headers stay and show that plan's count. The full table and the one-plan table are rendered from the same data and share the open groups, and the one not in use is display: none.

When should I use a grouped table rather than plan cards?

Use a grouped table when buyers check dozens of limits and features across three or more plans, as developers do with rate limits and authentication methods before they integrate: folding keeps the page short and lets each reader open only their group. Plan cards suit two or three plans with short feature lists, where the decision is quick and mostly about price.

  • Pro

    Comparison Table Pricing

    Comparison tables

    Four plans compared feature by feature in one table whose hairlines meet the page rails, with a billing switch, a tinted popular column and, on a phone, a plan switch that keeps the feature column beside one plan.

  • Pro

    Feature Matrix Pricing

    Comparison tables

    A feature matrix you can interrogate: search the features, hide the rows every plan shares with a switch, and watch a live count in the table's corner, over four chat plans and twenty-eight features.

  • Pro

    Government Plan Pricing

    Comparison tables

    Government pricing led by its compliance: a strip of large certification cells under the heading, then one table comparing three annual plans, with specialist terms explained on demand.

  • Pro

    Tiered API Pricing

    Comparison tables

    API tiers by request quota, with the quota as the headline: four columns open with 10k, 250k, 2M and 10M+ requests a month at display size, then the price, the overage rate and a call to action, over grouped limits and features.

  • Pro

    Three virtual-server plans laid out like a technical datasheet on the page column: a column per plan with its size, price and call to action, then grouped rows of monospaced specs on shared hairlines, and a plan switch on phones.

  • Pro

    Feature Diff Pricing

    Comparison tables

    One upgrade shown value by value: the price and call to action in one column, and in the other a ruled ledger with the Free limit struck through beside the Pro value on every row.