Pricing
Pricing table component with plans, feature lists, a highlighted plan and a monthly or yearly billing toggle.
How to use it
Run npx @blossomui/react add pricing, or copy src/components/UI/Pricing/Pricing.tsx into your React project and import it.
import { Pricing } from './components/ui/Pricing'
Props
PricingFeature
| Prop | Type | Description |
|---|
| label (required) | string | |
| included (required) | boolean | |
PricingPlan
| Prop | Type | Description |
|---|
| name (required) | string | |
| price (required) | number | Price per month. |
| features (required) | PricingFeature[] | |
| highlighted | boolean | Marks the recommended plan. |
| cta | string | |
PricingLabels
| Prop | Type | Description |
|---|
| billingPeriod (required) | string | |
| monthly (required) | string | |
| yearly (required) | string | |
| perMonth (required) | string | Text after the price when it is monthly, for example "month" for "/month". |
| perYear (required) | string | |
| subscribe (required) | string | |
PricingProps
| Prop | Type | Description |
|---|
| formatPrice | (price: number) => string | Formats the price of a plan, for example with `Intl.NumberFormat` to show another currency. |
| labels | Partial<PricingLabels> | |
| color | string | Accent color of this component: any CSS color. Without it the component uses `--blossom-accent`, which is pink by default. |
| plans (required) | PricingPlan[] | |
| variant | 'default' | 'border' | 'size' | `border` outlines the highlighted plan, `size` makes it bigger. |
| billingToggle | boolean | Shows a monthly / yearly switch. Yearly prices are calculated with `yearlyMonths` months. |
| yearlyMonths | number | |
| onSelect | (plan: PricingPlan, billing: 'monthly' | 'yearly') => void | |