# React Native Pricing Table and paywall plans (Pro)

> A React Native pricing table for iOS, Android and the web: plan cards with a Most popular highlight, a Monthly / Yearly toggle with the saving worked out, per-month prices, a feature comparison table, and a phone paywall list with radios. Accessible and animated.

# 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.

```tsx
import { PricingTable } from '@patine-ui/pro';
```

```tsx live full
import { PricingTable } from '@patine-ui/pro';

const plans = [
  { id: 'hobby', name: 'Hobby', description: 'For side projects', price: 0, priceLabel: 'Free', features: ['1 project', '10K requests / month', 'Community support'] },
  {
    id: 'pro',
    name: 'Pro',
    description: 'For growing teams',
    price: { monthly: 2900, yearly: 29000 },
    badge: 'Most popular',
    highlighted: true,
    featuresTitle: 'Everything in Hobby, plus:',
    features: ['Unlimited projects', '1M requests / month', 'Email support'],
  },
  { id: 'enterprise', name: 'Enterprise', description: 'For large organizations', price: null, cta: 'Contact sales', features: ['Custom limits', 'SSO and SCIM', 'Dedicated support'] },
];

export default function Example() {
  return <PricingTable plans={plans} onSelect={(plan, billing) => alert(`${plan.name}, ${billing}`)} footnote="Prices in USD. Cancel anytime." style={{ width: '100%' }} />;
}
```

## 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.

```tsx live wide
import { useState } from 'react';
import { View } from 'react-native';
import { Text } from 'patine-ui';
import { PricingTable } from '@patine-ui/pro';

const PLANS = [
  { id: 'starter', name: 'Starter', description: 'For one designer', price: { monthly: 1200, yearly: 12000 }, features: ['3 projects', 'Version history, 30 days', 'Export to PNG and SVG'] },
  {
    id: 'team',
    name: 'Team',
    description: 'For product teams',
    price: { monthly: 2400, yearly: 24000 },
    badge: 'Your plan',
    cta: 'Current plan',
    featuresTitle: 'Everything in Starter, plus:',
    features: ['Unlimited projects', 'Shared libraries', 'Version history, forever'],
  },
  {
    id: 'business',
    name: 'Business',
    description: 'For many teams',
    price: { monthly: 4500, yearly: 45000 },
    highlighted: true,
    badge: 'Recommended',
    featuresTitle: 'Everything in Team, plus:',
    features: ['SSO and SCIM', 'Audit log', 'Branch and merge'],
  },
];

export default function Example() {
  const [note, setNote] = useState('');
  return (
    <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.

```tsx live full
import { PricingTable } from '@patine-ui/pro';

const plans = [
  { id: 'starter', name: 'Starter', price: { monthly: 1200, yearly: 12000 }, features: ['3 seats', 'Basic analytics'] },
  { id: 'team', name: 'Team', price: { monthly: 4900, yearly: 47000 }, highlighted: true, badge: 'Best value', current: true, features: ['10 seats', 'Advanced analytics', 'Priority support'] },
];

export default function Example() {
  const [billing, setBilling] = React.useState('yearly');
  return <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.

```tsx live full
import { PricingTable } from '@patine-ui/pro';

const plans = [
  { id: 'free', name: 'Free', price: 0, features: [{ label: 'Projects', value: '3' }, { label: 'Storage', value: '1 GB' }, { label: 'SSO', value: false, group: 'Security' }, { label: 'Audit log', value: false, group: 'Security' }] },
  { id: 'pro', name: 'Pro', price: { monthly: 2900, yearly: 29000 }, highlighted: true, badge: 'Popular', features: [{ label: 'Projects', value: 'Unlimited' }, { label: 'Storage', value: '100 GB' }, { label: 'SSO', group: 'Security' }, { label: 'Audit log', value: false, group: 'Security' }] },
  { id: 'ent', name: 'Enterprise', price: null, features: [{ label: 'Projects', value: 'Unlimited' }, { label: 'Storage', value: 'Custom' }, { label: 'SSO', group: 'Security' }, { label: 'Audit log', group: 'Security' }] },
];

export default function Example() {
  return <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.

```tsx live full
import { PricingTable } from '@patine-ui/pro';

const plans = [
  { id: 'weekly', name: 'Weekly', price: 499, priceNote: 'Billed every week' },
  { id: 'yearly', name: 'Yearly', price: 3999, priceNote: '$0.77 a week, billed yearly', badge: 'Save 85%', highlighted: true },
  { id: 'lifetime', name: 'Lifetime', price: 9999, priceNote: 'Pay once' },
];

export default function Example() {
  return <PricingTable plans={plans} layout="list" showBillingToggle={false} onSelect={(plan) => alert(plan.name)} style={{ width: 360 }} />;
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `plans` | `PricingPlan[]` | — | See [Plans](#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` | | | |
