We use cookies to ensure you get the best experience on our website. Read our privacy policy

Skip to main content

Directory

Pricing Section

The Pricing section component creates responsive, interactive pricing tables with built-in support for monthly/yearly billing toggles, feature comparisons, and customizable tiers.

The Pricing section helps you:

  • Display pricing plans clearly and professionally
  • Toggle between monthly and yearly billing options
  • Highlight featured/popular plans
  • Show feature comparisons across tiers
  • Calculate and display savings for yearly plans
---
import Pricing from '@/components/NST-components/sections/pricing/Pricing.astro';
import { pricingData } from './your-pricing-data';
---
<Pricing data={pricingData} />

The pricing component expects a structured data object with the following format:

interface PriceData {
models: ['monthly' | 'yearly'];
defaultModel: 'monthly' | 'yearly';
tiers: {
id: string;
name: string;
description: string;
featured?: boolean;
price: {
monthly: number;
yearly: number;
};
features: {
[key: string]: {
value: boolean | string | number;
tooltip?: string;
};
};
cta: {
text: string;
href: string;
};
}[];
sections: {
name: string;
features: string[];
}[];
}
const pricingData = {
models: ['monthly', 'yearly'],
defaultModel: 'monthly',
tiers: [
{
id: 'free',
name: 'Free',
description: 'Perfect for getting started',
price: {
monthly: 0,
yearly: 0,
},
features: {
Projects: { value: 1 },
'Team Members': { value: 2 },
Support: { value: false },
},
cta: {
text: 'Get Started',
href: '/signup',
},
},
// ... additional tiers
],
sections: [
{
name: 'Core Features',
features: ['Projects', 'Team Members', 'Support'],
},
// ... additional sections
],
};
  • Seamless switching between monthly and yearly pricing
  • Automatic yearly discount calculation
  • Smooth price updates with transitions
  • Accessible toggle controls
{
// ... tier configuration
featured: true, // Adds visual emphasis and "Most Popular" badge
}
  • Boolean features (checkmark/cross)
  • Quantitative features (with units)
  • Tooltip support for additional context
  • Grouped feature sections

The component supports various styling options through CSS classes and custom properties:

<Pricing
data={pricingData}
class="custom-pricing-section"
/>
.custom-pricing-section {
--pricing-featured-shadow: 0 4px 6px -1px rgb(var(--color-primary) / 0.1);
--pricing-hover-transform: translateY(-4px);
--pricing-transition-duration: 300ms;
}
  • ARIA labels for interactive elements
  • Keyboard navigation support
  • High contrast mode compatibility
  • Screen reader optimized markup
  • Focus management for toggles
  1. Content Organization

    • Group related features logically
    • Order tiers from basic to premium
    • Keep feature descriptions concise
    • Use consistent terminology
  2. Visual Hierarchy

    • Highlight recommended plans appropriately
    • Maintain clear price visibility
    • Use adequate spacing between elements
    • Ensure mobile responsiveness
  3. Interaction Design

    • Provide clear toggle feedback
    • Animate price changes smoothly
    • Include clear calls-to-action
    • Maintain visible saving calculations
<Pricing
data={{
...pricingData,
features: {
customIcon: {
value: true,
icon: 'path/to/icon.svg'
}
}
}}
/>
<Pricing
data={{
...pricingData,
tiers: [{
...tier,
cta: {
text: 'Get Started',
href: '/signup',
class: 'custom-cta-button'
}
}]
}}
/>
  • Button - Used for CTA elements
  • Badge - For feature highlights
  • Card - Base styling for pricing tiers
  • Toggle - Monthly/yearly switch mechanism

Limited Time Launch Sale

Start building professional pricing sections today with our AstroJS starter template. Get instant access to the Pricing component and many more pre-built sections.

GET 60% OFF!
North Star Themes Logo

Subscribe to our newsletter

Get the latest AstroJS tips and tricks right to your inbox

Email: [email protected]

© 2025 North Star Themes

Web Kit Provided By North Star Themes