Plan comparison
A React block (a whole screen) in Beamline's Shop app, in the free sample.
Plans side by side against every feature: prices that roll between monthly and yearly, the current and recommended plan marked, a header that stays in view while the features scroll, differences only, and included, not included and not specified told apart.
Use it for
- An upgrade or pricing page where people compare plans feature by feature before choosing.
Not for
- Choosing a plan inside a checkout or settings form (radio-cards).
- Showing what the current plan uses (usage-meter).
Anatomy
- title and description
- billing period toggle (savings note)
- differences-only switch
- plan picker (narrow screens)
- sticky plan header (name, badges, price, period line, call to action)
- feature groups (group row, feature rows with an optional hint)
- cell: included (check) · not included (—) · a value · not specified (hatched)
Variants
- period: monthly, yearly
States
- monthly / yearly (prices roll)
- current plan (badge, its button says so)
- recommended plan (accent edge, badge, accent button)
- choosing (the plan's button busy, the others wait)
- choice failed (message under the button)
- differences only (equal rows hidden; nothing left says so)
- quote-only plan (Talk to sales)
- free plan
- narrow (under 640px, or sooner when a plan's column would be under 150px — four plans need about 830px): one plan at a time with a picker; its header spans the row (name, price and button at full width)
- middle room (to 1100px): the feature column narrows to a quarter so each plan keeps its name, price and button on one line
- header stuck (hairline shadow)
Keyboard
- Tab: period toggle, differences switch, plan picker (narrow), each plan's button, then each feature hint
- arrow keys move within the period toggle and the plan picker
- hints open on focus and close with Escape
Motion
Prices roll digit by digit when the period changes, and in a narrow room when the picker moves to another plan (the one column keeps its identity, so its price rolls from one plan's to the next). Only differences slides the rows that stay together and grows the ones that come back. The stuck header gains its shadow over --motion-in. Reduced motion swaps prices and places rows at once.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
plans (required) | PlanComparisonPlan[] | — | Plans offered for comparison or switching. Required. |
groups (required) | PlanFeatureGroup[] | — | Feature groups and their per-plan values shown in the comparison. Required. |
period / defaultPeriod / onPeriodChange | "monthly" | "yearly" | "yearly" | period: Billing period, controlled or not. Default yearly. defaultPeriod: Initial billing period when uncontrolled; defaults to yearly. onPeriodChange: Reports reporting period after a change; no callback by default. |
currentPlan | string | — | The plan the account is on now. |
recommendedPlan | string | — | The plan to steer people towards. |
onSelectPlan | (planId, period) => void | Promise<void> | — | A plan's button. Return a promise to show progress on it; a rejection shows its message under it. |
differencesOnly / defaultDifferencesOnly / onDifferencesOnlyChange | boolean | — | differencesOnly: Hide rows where every plan is the same, controlled or not. defaultDifferencesOnly: Initial differences only when uncontrolled. Defaults to false. onDifferencesOnlyChange: Reports differences only after a change; no callback by default. |
format | (amount: number) => string | — | Formats a price. Default whole US dollars. |
title / description | ReactNode | — | title: Heading shown above the content. Defaults to "Compare plans". description: Supporting text beneath the label or heading. Defaults to no supporting text. |
unknownLabel | string | "Not specified" | Words for a value that was never given. Default "Not specified". |
stickyOffset | number | 0 | Where the header sticks, in px from the top of the scrolling parent (under your own app bar). |
className | string | — | Classes on the documented visual root; no override by default. |
classNames | PlanComparisonClassNames | — | Classes for the named visual parts; no part overrides by default. |
style / ref | CSSProperties / Ref<HTMLDivElement> | — | style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default. |
style | CSSProperties | — | Inline styles on the documented visual root; no inline overrides by default. |
period | PlanPeriod | — | Billing period, controlled or not. Default yearly. |
defaultPeriod | PlanPeriod | — | Initial billing period when uncontrolled; defaults to yearly. |
onPeriodChange | ((period: PlanPeriod) => void) | — | Reports reporting period after a change; no callback by default. |
differencesOnly | boolean | — | Hide rows where every plan is the same, controlled or not. |
defaultDifferencesOnly | boolean | — | Initial differences only when uncontrolled. Defaults to false. |
onDifferencesOnlyChange | ((on: boolean) => void) | — | Reports differences only after a change; no callback by default. |
title | ReactNode | — | Heading shown above the content. Defaults to "Compare plans". |
description | ReactNode | — | Supporting text beneath the label or heading. Defaults to no supporting text. |
ref | Ref<HTMLDivElement> | — | Receives the documented root element; no ref by default. |
Built from
- slot-text
- table
- button
- badge
- switch
- tooltip
- segmented-control
- empty-state
Dependencies
lucide-react, motion
Import
import { PlanComparison } from "@beamline/plan-comparison";
Get it
Plan comparison is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Plan comparison is included in the free MIT sample. Get Beamline · Connect your agent
More in Shop
- Product editor: A product being made in a shop's back office, every value read as text at rest. The variant grid, grouped by the first option, lists each combination…
- Category manager: A shop's product categories, nested and ranked. Each category moves up, down or into another from its menu, and every move gets its own receipt (saving…
- Inventory item: One stock item in a shop's back office, apart from the variants that sell it (how many each uses per unit). Stock per location as stocked, reserved and…
- Step form: The finished frame for any multi-step form you compose — onboarding, intake brief, questionnaire, booking, application: a wide card with progress, the…
- Orders admin: A shop's order desk: today's orders and revenue, quick filters for what needs doing (to fulfil, unpaid, returns), a virtualised orders grid, and the…
- Order detail: One shop order with payment and fulfilment as two separate lanes. The header says where each stands (paid, partly paid, awaiting, refunded; not…
- Order board: A shop's orders as cards in its columns, on the shared kanban with drag and keyboard moves. Each card: number, estimate or work order, customer, vehicle…
- Order composer: An order made inside a support ticket: products found by name, each variant with its stock drawn and said (in stock, none, oversold, not known) and the…
- Draft orders: A draft order made for a customer in a shop's back office that reads like the order it will become. The lines lead: each with its variant and SKU or…
- Order changes: What happens to a shop order after it's placed. Edit: the order as it stands beside the requested version, each line marked new, changed (old → new…
- Special orders: Customers' special orders as demand to buy for, per outlet: To order apart from Ordered; each product's demand, what is reserved, incoming and on order…
- Order history and fills: Every order the account placed and every fill it got, for a period: totals for volume, fees, fill rate and maker share; orders with their status and how…
- Order ledger: Purchase orders as money. Each order's spend is drawn against its approved total (paid, billed, pending, what is left, and any overrun past the end…
- Ticket orders: A customer's orders inside a support ticket, each action's effect said before it's done: orders and drafts kept apart, a paid draft shown once as its…
- Record search: One search across connected records (customers, vehicles, orders) by name, phone, plate, VIN or order number. What the words look like is said (info)…
- Return queue: A queue of return cases. Search by return, order or customer, exactly (the default) or loosely; status tabs with counts, Requires attention first; a date…
- Return case: One return as one place where every act is its own. The return, its order (linked out) and the customer on three cards; the stage said on its tone. Items…
- Return request: Staff start a return from an order, and edit the reasons customers pick. New return: the order's lines as a checklist, each with its variant, price and…
- Purchase orders: A salon's purchase orders, received: the orders down the side, the chosen one beside them. Each line still due reads as a strip of received, this…
- Print quote: A print shop's quoting in three places. Quote: a group of garments that share one imprint and one quantity break, the group's pieces counted together and…
- Service estimate: An estimate for one vehicle. Services added from the catalogue (one not listed for this vehicle said on warning, fit unknown said); each with its lines…
- Job card: A technician's repair order, phone-first. The vehicle, the customer and when it's due in words (due at, due in, overdue by how long); an offline copy…
- Parts tracker: Parts across a shop's work orders: each with its number, the order and vehicle, supplier, quantity and cost (not known said), and where it is: ordered…
- Visit board: The staff board for a walk-in queue: visits move from waiting through called and serving to done today. Arrival (here or on the way), the place in the…