Pricing Table

Premium, accessible pricing tables with billing toggle, feature comparisons, and multiple variants.

Quick Start

  1. Include pricing-table.css and pricing-table.js
  2. Add data-rsl-pricing-table to your container
  3. Add tiers with data-tier-name and data-tier-price-monthly
  4. Add features with data-feature-included

Basic HTML Structure

Basic Pricing Table HTML
<div data-rsl-pricing-table data-pricing-currency="$">

    <!-- Tier 1: Basic -->
    <div data-tier-name="Basic"
         data-tier-description="For individuals"
         data-tier-price-monthly="9"
         data-tier-price-annual="7"
         data-tier-cta-text="Get Started"
         data-tier-cta-url="/signup?plan=basic">

        <div data-feature-text="5 Projects" data-feature-included="true"></div>
        <div data-feature-text="10GB Storage" data-feature-included="true"></div>
        <div data-feature-text="Priority Support" data-feature-included="false"></div>
    </div>

    <!-- Tier 2: Pro (Highlighted) -->
    <div data-tier-name="Pro"
         data-tier-description="For growing teams"
         data-tier-price-monthly="29"
         data-tier-price-annual="24"
         data-tier-highlighted="true"
         data-tier-badge="Most Popular"
         data-tier-cta-text="Start Free Trial"
         data-tier-cta-url="/signup?plan=pro">

        <div data-feature-text="Unlimited Projects" data-feature-included="true"></div>
        <div data-feature-text="100GB Storage" data-feature-included="true"></div>
        <div data-feature-text="Priority Support" data-feature-included="true"></div>
    </div>

    <!-- Tier 3: Enterprise -->
    <div data-tier-name="Enterprise"
         data-tier-description="For large organizations"
         data-tier-custom-price="Contact Sales"
         data-tier-cta-text="Contact Us"
         data-tier-cta-url="/contact">

        <div data-feature-text="Custom Limits" data-feature-included="true"></div>
        <div data-feature-text="Unlimited Storage" data-feature-included="true"></div>
        <div data-feature-text="Dedicated Support" data-feature-included="true"></div>
    </div>

</div>

Container Data Attributes

Attribute Values Default Description
data-rsl-pricing-table - - Required. Initializes the pricing table.
data-pricing-variant cards, comparison, compact, horizontal cards Visual layout variant.
data-pricing-currency Any string $ Currency symbol to display.
data-pricing-currency-position before, after before Currency symbol position relative to price.
data-pricing-period Any string mo Billing period text (e.g., "mo", "month", "yr").
data-pricing-toggle-monthly Any string Monthly Label for monthly toggle option.
data-pricing-toggle-annual Any string Annual Label for annual toggle option.
data-pricing-savings-template String with {{percent}} Save {{percent}}% Template for savings badge text.
data-pricing-animate true, false false Enable scroll-triggered entrance animation.
data-pricing-mobile-accordion true, false false Convert to accordion on mobile screens.
data-filterbus-key Any string - FilterBus key for filtering tiers.

Tier Data Attributes

Attribute Values Description
data-tier-name Any string Required. The tier/plan name (e.g., "Basic", "Pro").
data-tier-description Any string Short description below the tier name.
data-tier-price-monthly Number Monthly price. Required for billing toggle.
data-tier-price-annual Number Annual price (per month). Required for billing toggle.
data-tier-original-price Number Original price to show as strikethrough.
data-tier-custom-price Any string Custom price text (e.g., "Free", "Contact Sales").
data-tier-price-note Any string Note below price (e.g., "billed annually").
data-tier-highlighted true, false Apply highlighted/featured styling.
data-tier-badge Any string Badge text (e.g., "Most Popular", "Best Value").
data-tier-badge-variant success, warning Badge color variant.
data-tier-cta-text Any string Call-to-action button text.
data-tier-cta-url URL Call-to-action button link.
data-tier-cta-variant primary, secondary CTA button style variant.
data-filter-value Any string (comma-separated) FilterBus value(s) for this tier.

Feature Data Attributes

Attribute Values Description
data-feature-text Any string Feature description text.
data-feature-included true, false, custom string Feature state: true = included (checkmark), false = excluded (X), any other value = partial (info icon).
data-feature-tooltip Any string Tooltip text for additional details.
data-feature-category Any string Feature category (creates group headers).

Partial Features

For features with limitations, use a custom value for data-feature-included (e.g., "partial", "limited") and add a tooltip explaining the limitation.

JavaScript API

Method Parameters Description
RSL.PricingTable.init() - Initialize all pricing tables on page.
RSL.PricingTable.create(element, options) Element or selector, options object Create a pricing table instance programmatically.
RSL.PricingTable.destroy(element) Element or selector Destroy a pricing table instance.
RSL.PricingTable.getInstance(element) Element or selector Get the instance for an element.
RSL.PricingTable.setBilling(element, isAnnual) Element or selector, boolean Set billing period programmatically.
RSL.PricingTable.isAnnual(element) Element or selector Check if annual billing is selected.

Events

Event Detail Description
rsl-pricing-toggle { isAnnual: boolean, period: string } Fired when billing toggle changes.
Event Listener Example JavaScript
document.querySelector('[data-rsl-pricing-table]')
    .addEventListener('rsl-pricing-toggle', function(e) {
        console.log('Billing changed:', e.detail.period);
        console.log('Is annual:', e.detail.isAnnual);

        // Update analytics, etc.
    });

Accessibility

The Pricing Table component is WCAG 2.1 AA compliant with:

Toggle Accessibility

The billing toggle uses role="switch" with aria-checked for proper screen reader announcements. Arrow keys navigate between monthly and annual options.

CSS Variables

Variable Default Description
--rsl-pricing-accent #6366f1 Primary accent color
--rsl-pricing-bg #ffffff Background color
--rsl-pricing-border #e2e8f0 Border color
--rsl-pricing-check #10b981 Included feature icon color
--rsl-pricing-cross #ef4444 Excluded feature icon color
--rsl-pricing-partial #f59e0b Partial feature icon color
--rsl-pricing-radius 16px Border radius for tier cards
--rsl-pricing-padding 2rem Card padding

JSON Layout API (V2)

Build pricing tables programmatically using the V2 JSON API. The pricing-table content type renders complete pricing tables with all features.

JSON API Example JavaScript
RSL.JSONLayout.renderLayout('#pricing-container', {
    version: 2,
    layoutId: "pricing-demo",
    breakpoints: { xs: 1 },
    items: [{
        content: {
            type: "pricing-table",
            currency: "$",
            animate: true,
            tiers: [
                {
                    name: "Starter",
                    description: "Perfect for individuals",
                    priceMonthly: 9,
                    priceAnnual: 7,
                    ctaText: "Get Started",
                    ctaUrl: "#signup",
                    features: [
                        { text: "5 Projects", included: true },
                        { text: "API Access", included: false }
                    ]
                },
                {
                    name: "Pro",
                    priceMonthly: 29,
                    priceAnnual: 24,
                    badge: "Most Popular",
                    highlighted: true,
                    ctaText: "Start Trial",
                    ctaVariant: "primary",
                    features: [
                        { text: "Unlimited Projects", included: true },
                        { text: "API Access", included: true }
                    ]
                }
            ]
        }
    }]
});

V2 API Benefits

The JSON API provides declarative pricing table creation, making it easy to build dynamic pricing pages from backend data or CMS content.

View JSON API Examples

Ready to See It in Action?

Check out our interactive examples with all variants and configurations.

View Examples