Search documentation v0.8.1

Pricing Table

Display a list of pricing options

Source ↗️ Report Issue ↗️

Use the PricingTable component to display various pricing options or subscription plans in a clear, comparative layout, helping users make informed purchasing decisions.

Simple Pricing Table
Free
  • Pricing Table with only required fields
Unlock code
How to use the PricingTable component in Astro
<PricingTable options={[{
title: 'Simple Pricing Table',
price: 'Free',
features: [
'Pricing Table with only required fields'
]
}]} />

The PricingTable component expects a single options prop in the form of an array of option objects. Each object must have at least the following properties:

Sometimes, you may want to provide a period with a pricing such as monthly for subscriptions, or one-time for a single payment. This can be added by setting the period prop for an option object:

Pricing Table with Period
$15/one-time
  • Pay once, get access forever
  • Priority support
Unlock code
How to specify a period for an option
<PricingTable options={[{
title: 'Pricing Table with Period',
price: '$15',
period: 'one-time',
features: [
'Pay once, get access forever',
'Priority support'
]
}]} />

CTAs

As seen in the above example, the PricingTable can be created with CTA buttons. To add them, use the buttons prop on the option object, that should reference an array of Button components:

Single CTA
$15
  • Use any button prop
Multiple CTA
$15
  • Use any button prop
Unlock code
How to add a CTA button
<PricingTable options={[{
title: 'Single CTA',
price: '$15',
features: [
'Use any button prop'
],
buttons: [{
text: 'Get Started'
}]
}]} />
Unlock code
How to add multiple CTA buttons
<PricingTable options={[{
title: 'Multiple CTA',
price: '$15',
features: [
'Use any button prop'
],
buttons: [{
text: 'Get Started'
}, {
text: '🎁 Gift a subscription',
theme: 'secondary'
}]
}]} />

Ribbons

If you want to provide additional important information alongside with an option, you can use the ribbon prop to display that on top of the table:

Pricing Table with Ribbon
Standard
$15/one-time
  • Pay once, get access forever
  • Priority support
Custom ribbon colors
Standard
$15/one-time
  • Pay once, get access forever
  • Priority support
Unlock code
How to add a ribbon to your table
<PricingTable options={[{
...
ribbon: {
label: 'Pricing Table with Ribbon'
}
}]} />
Unlock code
How to customize ribbon colors
<PricingTable options={[{
...
ribbon: {
label: 'Custom ribbon colors',
colorText: 'var(--w-color-primary-70)',
colorStart: 'var(--w-color-warning)',
colorEnd: 'var(--w-color-warning-accent)'
}
}]} />

You can use existing Webcore theme color CSS variables for your colors. See the theme documentation for all available color variables. If you want to globally specify a custom ribbon color for all of your pricing tables, the recommended way is to override the following CSS variables once:

Unlock code
How to customize ribbon colors with CSS
html body {
--w-pricing-table-ribbon-color: var(--w-color-primary);
--w-pricing-table-ribbon-bg-start: var(--w-color-success);
--w-pricing-table-ribbon-bg-end: var(--w-color-success-accent);
}

In case you want to highlight one option from many, you can set the recommended property to true on an option object to scale up the option:

30% Discount
Basic
$9/month
  • Pricing table with 3 options
  • Access to all components
  • No hidden fees
  • Technical support
  • Free updates
Best value
Premium
$160/year
  • Pricing table with 3 options
  • Access to all components
  • No hidden fees
  • Technical support
  • Free updates

Unlock code
How to create recommended options
<PricingTable options={[
{ ... },
{
ribbon: {
label: 'Recommended'
},
recommended: true,
title: 'Standard',
...
},
{ ... }
]} />

Glow Effect

If you want to further emphasize an option, you can also add a glow effect by setting the glow property of an option object to true:

30% Discount
Basic
$9/month
  • Pricing table with 3 options
  • Access to all components
  • No hidden fees
  • Technical support
  • Free updates
Best value
Premium
$160/year
  • Pricing table with 3 options
  • Access to all components
  • No hidden fees
  • Technical support
  • Free updates

Unlock code
How to add a glow effect to an option
<PricingTable options={[
{ ... },
{
...,
glow: true,
glowOptions: {
blurAmount: 50
}
},
{ ... }
]} />

You can further customize your glow effect by specifying a glowOptions property, which accepts any valid GradientCardProps type. Please see the API documentation of the GradientCard component to see available customization options.

API

Unlock code
Component API reference
type PricingTableProps = {
options: {
ribbon?: {
colorText?: string
colorStart?: string
colorEnd?: string
label: string
},
recommended?: boolean
glow?: boolean
glowOptions?: GradientCardProps
title: string
price: string
period?: string
features: string[]
buttons?: ({
text: string
icon?: string
} & ButtonProps)[]
}[]
className?: string
}
Please see the documentation of the GradientCard component for the GradientCardProps type, and consult the documentation of the Button component for the ButtonProps type.
PropPurpose
options Sets the options for the pricing table.
options.ribbon.label Sets a ribbon for the option.
options.ribbon.colorText Sets the text color of the ribbon.
options.ribbon.colorStart Sets the start color of the ribbon's background.
options.ribbon.colorEnd Sets the end color of the ribbon's background.
recommended Sets the option as recommended, adding a scale effect.
glow Adds a glow effect to the option.
glowOptions Customizes the appearance of the glow. See the API documentation of the GradientCard.
title Sets a title for the option.
price Sets a price for the option.
period Sets a period after the price.
features Adds a list of features. Use an array of strings.
buttons Sets CTA buttons at the bottom of the option.
buttons.text Sets the label for the CTA.
buttons.icon Sets an icon for the CTA. You can pass SVG strings, or an icon type for Astro components.
className Pass additional CSS classes for pricing table.

Request improvement for this page