Pricing table Pro
Plans and prices, three ways: cards side by side with the popular one raised, a feature-by-feature comparison table, or a list to pick from with one Continue button, as phone paywalls do. A Monthly / Yearly toggle shows what yearly saves ("Save 17%", worked out from your prices) and swaps every price with a soft fade. Prices are in cents, like the rest of Pro.
import { PricingTable } from '@patine-ui/pro';
<PricingTable plans={plans} onSelect={(plan, billing) => alert(`${plan.name}, ${billing}`)} footnote="Prices in USD. Cancel anytime." style={{ width: '100%' }} />
Try the props
layoutdesign<PricingTable plans={plans} onSelect={checkout} />
Example: an upgrade screen
A design tool's upgrade screen for a team that's already paying: the current plan says so instead of offering itself, yearly billing shows the monthly price it works out to, and choosing a plan confirms what changes.
<View style={{ width: '100%', gap: 12 }}> <PricingTable plans={PLANS} currency="EUR" perMonth onSelect={(plan, billing) => setNote(plan.id === 'team' ? 'You’re already on Team.' : `Switch to ${plan.name}, billed ${billing}. The difference is prorated from today.`) } footnote="Per editor. Prices exclude VAT." /> {note ? <Text color="textSecondary">{note}</Text> : null} </View>
Plans
Each plan is { id, name, description?, price, priceLabel?, priceNote?, icon?, badge?, highlighted?, current?, featuresTitle?, features?, cta?, ctaVariant?, disabled? }. price is one amount in cents, one per period ({ monthly, yearly }), or null for a custom price ("Custom", or your priceLabel). current marks the user's plan: its button says Current plan. A feature is a string, or { label, value?, note?, group? } where value: false shows it left out and a string shows an amount ("100 GB Storage").
Billing periods
billingOptions sets the toggle's periods (default Monthly and Yearly; add badge or months to your own). billing, defaultBilling and onBillingChange control it. perMonth shows longer periods per month, with "Billed $290 yearly" under the price.
<PricingTable plans={plans} billing={billing} onBillingChange={setBilling} perMonth onSelect={() => {}} style={{ width: 600 }} />
Comparison table
layout="comparison" puts plans in columns and every feature in a row, with a check, a dash or the amount in each cell, grouped under each feature's group. It scrolls sideways when narrow.
<PricingTable plans={plans} layout="comparison" onSelect={() => {}} style={{ width: '100%' }} />
Phone paywall
layout="list" stacks the plans as radio rows over one Continue button, which calls onSelect with the chosen plan. value and onValueChange control the choice; the highlighted plan is chosen at first.
<PricingTable plans={plans} layout="list" showBillingToggle={false} onSelect={(plan) => alert(plan.name)} style={{ width: 360 }} />
Props
| Prop | Type | Default | Description |
|---|---|---|---|
plans | PricingPlan[] | — | See Plans. |
layout | 'cards' | 'comparison' | 'list' | 'cards' | |
billingOptions | { value, label, badge?, months? }[] | Monthly, Yearly | |
billing / defaultBilling / onBillingChange | string | first option | |
showBillingToggle | boolean | when prices differ by period | |
perMonth | boolean | false | Longer periods per month. |
value / defaultValue / onValueChange | string | the highlighted plan | The chosen plan (list layout). |
onSelect | (plan, billing) => void | — | A plan's button, or Continue. |
currency / locale / priceFormatter | 'USD' | ||
minCardWidth | number | 240 | Cards stack below it. |
footnote | string | — | |
renderPlan | (info) => ReactNode | — | A card's body. |
loading / error / onRetry / emptyTitle / renderEmpty | States. | ||
density / animate / labels / design / theme / style |