How to Create an Awesome Pricing Section with Tailwind CSS in React
Let me set the scene for you: itโs 10 p.m., and Iโm halfway through a tub of Ben & Jerryโs Cherry Garcia. My clientโa startup with a brand voice that screams โWeโre quirky but professional!โโjust requested a pricing section for their app. Simple, right? Except they wanted it to be responsive, visually appealing, and ready yesterday. Classic.

If youโve ever been in the โIโll code my way out of thisโ club, welcome. In todayโs post, Iโm going to walk you through creating a sleek pricing section using Tailwind CSS and React. Bonus: weโll keep the code as clean as your momโs kitchen counters (if sheโs anything like mine).
Step 1: Understand What Weโre Building
Weโll create a pricing component with two plans: Hobby and Enterprise. The Hobby tier is for newcomers, while the Enterprise tier has all the bells and whistles. Each tier will include features, a price, and a CTA button. Oh, and weโll add some tasteful gradients because โmodern designโ.

Hereโs the design breakdown:
- Hobby Plan:ย Simple and approachable.
- Enterprise Plan:ย Sleek, feature-packed, and gets extra love with shadows and colors.
Step 2: Set Up Your Project
Youโll need a React project with Tailwind CSS installed. If youโre starting from scratch, run this in your terminal:
npx create-react-app pricing-component
cd pricing-component
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init
Update your tailwind.config.js and include Tailwindโs directives in your src/index.css:
@tailwind base;
@tailwind components;
@tailwind utilities;
Once your setup is good to go, fire up the dev server with npm start. Time to code!
Step 3: The Code (Finally!)
Hereโs the component weโll build. Copy this into a new fileโPricingSection.js:
import { CheckIcon } from '@heroicons/react/20/solid';
const tiers = [
{
name: 'Hobby',
id: 'tier-hobby',
href: '#',
priceMonthly: '$29',
description: "The perfect plan if you're just getting started with our product.",
features: ['25 products', 'Up to 10,000 subscribers', 'Advanced analytics', '24-hour support response time'],
featured: false,
},
{
name: 'Enterprise',
id: 'tier-enterprise',
href: '#',
priceMonthly: '$99',
description: 'Dedicated support and infrastructure for your company.',
features: [
'Unlimited products',
'Unlimited subscribers',
'Advanced analytics',
'Dedicated support representative',
'Marketing automations',
'Custom integrations',
],
featured: true,
},
];
function classNames(...classes) {
return classes.filter(Boolean).join(' ');
}
export default function PricingSection() {
return (
<div className="relative isolate bg-white px-6 py-24 sm:py-32 lg:px-8">
<div className="mx-auto max-w-4xl text-center">
<h2 className="text-base font-semibold text-indigo-600">Pricing</h2>
<p className="mt-2 text-5xl font-semibold tracking-tight text-gray-900 sm:text-6xl">
Choose the right plan for you
</p>
</div>
<p className="mx-auto mt-6 max-w-2xl text-center text-lg text-gray-600">
Choose an affordable plan thatโs packed with the best features for engaging your audience, creating customer loyalty, and driving sales.
</p>
<div className="mx-auto mt-16 grid max-w-lg grid-cols-1 gap-y-6 lg:max-w-4xl lg:grid-cols-2">
{tiers.map((tier) => (
<div
key={tier.id}
className={classNames(
tier.featured ? 'relative bg-gray-900 shadow-2xl' : 'bg-white/60',
'rounded-3xl p-8 ring-1 ring-gray-900/10'
)}
>
<h3 className={classNames(tier.featured ? 'text-indigo-400' : 'text-indigo-600', 'text-base font-semibold')}>
{tier.name}
</h3>
<p className="mt-4 text-5xl font-semibold text-gray-900">{tier.priceMonthly}</p>
<p className="mt-6 text-gray-600">{tier.description}</p>
<ul className="mt-8 space-y-3 text-sm text-gray-600">
{tier.features.map((feature) => (
<li key={feature} className="flex gap-x-3">
<CheckIcon className="h-6 w-5 text-indigo-600" />
{feature}
</li>
))}
</ul>
<a
href={tier.href}
className="mt-8 block rounded-md bg-indigo-500 px-3.5 py-2.5 text-center text-sm font-semibold text-white hover:bg-indigo-400"
>
Get started today
</a>
</div>
))}
</div>
</div>
);
}
Step 4: Customize and Style
Tailwind gives you a strong base, but feel free to tweak the colors, typography, or spacing to match your brand. Want a different gradient? Swap it out in the bg-gradient-to-tr class. Need rounded corners for days? Bump up the rounded-3xl to rounded-full. Flex your creativity.
Step 5: Test and Deploy
Donโt forget to test on multiple devices. Tailwindโs responsive utilities (e.g.,ย sm:,ย lg:) are a lifesaver. Once youโre satisfied, deploy your app with your favorite hosting serviceโVercel, Netlify, you name it.
Wrap-Up
And there you have itโa responsive, visually pleasing pricing section built with Tailwind CSS and React. If your clientโs jaw doesnโt drop when they see it, at least you know itโs awesome. ๐
Got questions or want to share your version of this component? Drop me a comment below or hit me up on Twitter. Letโs geek out about code together!