- Published on
Ultimate Guide: Make A Pricing Page With Tailwind CSS

- What is Tailwind CSS?
- The description of Pricing page ui component
- Why use Tailwind CSS to build a Pricing page ui component?
- The preview of Pricing page ui component
- The source code of Pricing page ui component
- How to build a Pricing page with Tailwind CSS?
- Install tailwind css of verion 2.0.3
- All the unility class needed to build a Pricing page component
- 63 steps to build a Pricing page component with Tailwind CSS
- Conclusion
What is Tailwind CSS?
Tailwind CSS is a utility-first CSS framework that focuses on creating personalized user interfaces quickly. It can gives you all the building blocks you are able to create personalized designs without having to fight to override irritating opinionated styles. Also, Tailwind CSS is a highly configurable, low-level CSS framework.
The description of Pricing page ui component
Pricing page
Why use Tailwind CSS to build a Pricing page ui component?
- It can make the building process of Pricing page ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Pricing page component file.
The preview of Pricing page ui component
Free download of the Pricing page's source code
The source code of Pricing page ui component
<style>
[x-cloak] {
display: none;
}
</style>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
<div class="container mx-auto antialiased text-gray-900 bg-white" x-data="setup()">
<!-- Navbar -->
<nav>
<div class="flex items-center justify-between px-4 py-2">
<!-- Logo -->
<div class="flex items-center justify-start w-1/4">
<a href="#">
<span class="sr-only">Home</span>
<span class="text-2xl font-semibold"><span class="text-indigo-500">K</span>-UI </span>
</a>
</div>
<!-- Mobile menu button -->
<button
@click="isNavOpen = !isNavOpen"
x-cloak
class="inline-flex items-center justify-center text-gray-400 rounded-md lg:hidden focus:outline-none focus:ring-2 focus:ring-indigo-500"
type="button"
aria-controls="mobile-menu"
:aria-expanded="isNavOpen ? 'true' : 'false'"
>
<span class="sr-only">Open main menu</span>
<!-- Menu icon -->
<svg
x-show="!isNavOpen"
class="w-8 h-8"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
aria-hidden="true"
>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
<!-- X icon -->
<svg
x-show="isNavOpen"
class="w-8 h-8"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
aria-hidden="true"
>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
<!-- Desktop Middle links -->
<div class="items-center justify-center hidden w-1/2 lg:flex">
<a
href="#"
class="px-4 py-2 text-base font-medium text-gray-400 transition-colors rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-700"
>
Home
</a>
<a
href="#"
class="px-4 py-2 text-base font-medium text-gray-900 transition-colors rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-700"
>
Pricing
</a>
<a
href="#"
class="px-4 py-2 text-base font-medium text-gray-400 transition-colors rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-700"
>
Services
</a>
<a
href="#"
class="px-4 py-2 text-base font-medium text-gray-400 transition-colors rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-700"
>
Blog
</a>
</div>
<!-- Desktop Right links -->
<div class="items-center justify-end hidden w-1/4 space-x-2 lg:flex">
<a
href="#"
class="px-4 py-2 text-base font-medium text-gray-400 transition-colors rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-500"
>
Login
</a>
<a
href="#"
class="inline-flex justify-center px-4 py-2 text-sm font-medium text-white bg-indigo-600 border border-transparent rounded-full shadow-sm whitespace-nowrap hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
>
Get Started
</a>
</div>
</div>
<!-- Mobile menu -->
<div id="mobile-menu" class="flex flex-col items-center space-y-3 lg:hidden" x-cloak x-show="isNavOpen" @click.away="isNavOpen = false">
<a
href="#"
class="px-4 py-2 text-base font-medium text-gray-400 transition-colors rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-700"
>
Home
</a>
<a
href="#"
class="px-4 py-2 text-base font-medium text-gray-900 transition-colors rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-700"
>
Pricing
</a>
<a
href="#"
class="px-4 py-2 text-base font-medium text-gray-400 transition-colors rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-700"
>
Services
</a>
<a
href="#"
class="px-4 py-2 text-base font-medium text-gray-400 transition-colors rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-700"
>
Blog
</a>
<a
href="#"
class="px-4 py-2 text-base font-medium text-gray-400 transition-colors rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-indigo-500"
>
Login
</a>
<a
href="#"
class="inline-flex justify-center px-4 py-2 text-sm font-medium text-white bg-indigo-600 border border-transparent rounded-full shadow-sm whitespace-nowrap hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
>
Get Started
</a>
</div>
</nav>
<main class="mx-4 my-16">
<div class="text-center">
<h1 class="mb-4 text-2xl font-normal md:text-3xl lg:text-4xl">
Our <span class="font-semibold">plans</span> for your <span class="font-semibold">strategies</span>
</h1>
<p class="text-sm font-normal text-gray-400">
See below our main three plans for your business, for your startup and agency.
</p>
<p class="text-sm font-normal text-gray-400">
It start from here! You can teach yourself what you really like.
</p>
</div>
<!-- Plan switch -->
<div class="flex items-center justify-center mt-10 space-x-4">
<span class="text-base font-medium">Bill Monthly</span>
<button
class="relative rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
x-cloak
@click="billPlan == 'monthly' ? billPlan = 'annually' : billPlan = 'monthly'"
>
<div class="w-16 h-8 transition bg-indigo-500 rounded-full shadow-md outline-none"></div>
<div
class="absolute inline-flex items-center justify-center w-6 h-6 transition-all duration-200 ease-in-out transform bg-white rounded-full shadow-sm top-1 left-1"
:class="{ 'translate-x-0': billPlan == 'monthly', 'translate-x-8': billPlan == 'annually' }"
></div>
</button>
<span class="text-base font-medium">Bill Annually</span>
</div>
<!-- Plans -->
<div
class="flex flex-col items-center justify-center mt-16 space-y-8 lg:flex-row lg:items-stretch lg:space-x-8 lg:space-y-0"
>
<template x-for="(plan, i) in plans" x-key="i">
<section class="flex flex-col w-full max-w-sm p-12 space-y-6 bg-white rounded-lg shadow-md">
<!-- Price -->
<div class="flex-shrink-0">
<span
class="text-4xl font-medium tracking-tight"
:class="plan.name == 'Basic' ? 'text-green-500' : ''"
x-text="`${billPlan == 'monthly' ? plan.price.monthly : plan.price.annually}`"
></span>
<span class="text-gray-400" x-text="billPlan == 'monthly' ? '/month' : '/year'"></span>
</div>
<!-- -->
<div class="flex-shrink-0 pb-6 space-y-2 border-b">
<h2 class="text-2xl font-normal" x-text="plan.name"></h2>
<p class="text-sm text-gray-400" x-text="plan.discretion"></p>
</div>
<!-- Features -->
<ul class="flex-1 space-y-4">
<template x-for="(feature, i) in plan.features" x-key="i">
<li class="flex items-start">
<svg
class="w-6 h-6 text-green-300"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
>
<path
fill-rule="evenodd"
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
clip-rule="evenodd"
/>
</svg>
<span class="ml-3 text-base font-medium" x-text="feature"></span>
</li>
</template>
</ul>
<!-- Button -->
<div class="flex-shrink-0 pt-4">
<button
class="inline-flex items-center justify-center w-full max-w-xs px-4 py-2 transition-colors border rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
:class="plan.name == 'Basic' ? 'bg-indigo-500 text-white hover:bg-indigo-700' : 'hover:bg-indigo-500 hover:text-white'"
x-text="`Get ${plan.name}`"
></button>
</div>
</section>
</template>
</div>
</main>
<!-- Author links -->
<div class="fixed flex items-center space-x-4 bottom-5 left-5">
<a href="https://twitter.com/ak_kamona" target="_blank" class="transition-transform transform hover:scale-125">
<span class="sr-only">Twitter</span>
<svg
aria-hidden="true"
class="w-8 h-8 text-blue-500"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
>
<path
d="M19.633,7.997c0.013,0.175,0.013,0.349,0.013,0.523c0,5.325-4.053,11.461-11.46,11.461c-2.282,0-4.402-0.661-6.186-1.809 c0.324,0.037,0.636,0.05,0.973,0.05c1.883,0,3.616-0.636,5.001-1.721c-1.771-0.037-3.255-1.197-3.767-2.793 c0.249,0.037,0.499,0.062,0.761,0.062c0.361,0,0.724-0.05,1.061-0.137c-1.847-0.374-3.23-1.995-3.23-3.953v-0.05 c0.537,0.299,1.16,0.486,1.82,0.511C3.534,9.419,2.823,8.184,2.823,6.787c0-0.748,0.199-1.434,0.548-2.032 c1.983,2.443,4.964,4.04,8.306,4.215c-0.062-0.3-0.1-0.611-0.1-0.923c0-2.22,1.796-4.028,4.028-4.028 c1.16,0,2.207,0.486,2.943,1.272c0.91-0.175,1.782-0.512,2.556-0.973c-0.299,0.935-0.936,1.721-1.771,2.22 c0.811-0.088,1.597-0.312,2.319-0.624C21.104,6.712,20.419,7.423,19.633,7.997z"
></path>
</svg>
</a>
<a href="https://github.com/Kamona-WD" target="_blank" class="transition-transform transform hover:scale-125">
<span class="sr-only">Github</span>
<svg
aria-hidden="true"
class="w-8 h-8 text-black"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M12.026,2c-5.509,0-9.974,4.465-9.974,9.974c0,4.406,2.857,8.145,6.821,9.465 c0.499,0.09,0.679-0.217,0.679-0.481c0-0.237-0.008-0.865-0.011-1.696c-2.775,0.602-3.361-1.338-3.361-1.338 c-0.452-1.152-1.107-1.459-1.107-1.459c-0.905-0.619,0.069-0.605,0.069-0.605c1.002,0.07,1.527,1.028,1.527,1.028 c0.89,1.524,2.336,1.084,2.902,0.829c0.091-0.645,0.351-1.085,0.635-1.334c-2.214-0.251-4.542-1.107-4.542-4.93 c0-1.087,0.389-1.979,1.024-2.675c-0.101-0.253-0.446-1.268,0.099-2.64c0,0,0.837-0.269,2.742,1.021 c0.798-0.221,1.649-0.332,2.496-0.336c0.849,0.004,1.701,0.115,2.496,0.336c1.906-1.291,2.742-1.021,2.742-1.021 c0.545,1.372,0.203,2.387,0.099,2.64c0.64,0.696,1.024,1.587,1.024,2.675c0,3.833-2.33,4.675-4.552,4.922 c0.355,0.308,0.675,0.916,0.675,1.846c0,1.334-0.012,2.41-0.012,2.737c0,0.267,0.178,0.577,0.687,0.479 C19.146,20.115,22,16.379,22,11.974C22,6.465,17.535,2,12.026,2z"
></path>
</svg>
</a>
</div>
</div>
<script>
const setup = () => {
return {
isNavOpen: false,
billPlan: 'monthly',
plans: [
{
name: 'Easy',
discretion: 'All the basics for businesses that are just getting started.',
price: {
monthly: 29,
annually: 29 * 12 - 199,
},
features: ['One project', 'Your dashboard'],
},
{
name: 'Basic',
discretion: 'Better for growing businesses that want more customers.',
price: {
monthly: 59,
annually: 59 * 12 - 100,
},
features: ['Two projects', 'Your dashboard', 'Components included', 'Advanced charts'],
},
{
name: 'Custom',
discretion: 'Advanced features for pros who need more customization.',
price: {
monthly: 139,
annually: 139 * 12 - 100,
},
features: ['Unlimited projects', 'Your dashboard', '+300 Components', 'Chat support'],
},
],
}
}
</script>
How to build a Pricing page with Tailwind CSS?
Install tailwind css of verion 2.0.3
Use the script
html tag to import the script of Tailwind CSS of the version 2.0.3
<script src="https://cdn.tailwindcss.com"></script>
All the unility class needed to build a Pricing page component
mx-auto
text-gray-900
bg-white
flex
px-4
py-2
justify-start
w-1/4
text-2xl
text-indigo-500
inline-flex
text-gray-400
lg:hidden
w-8
h-8
hidden
w-1/2
lg:flex
text-base
hover:text-gray-900
text-sm
text-white
bg-indigo-600
border-transparent
hover:bg-indigo-700
flex-col
mx-4
my-16
text-center
mb-4
md:text-3xl
lg:text-4xl
mt-10
relative
w-16
bg-indigo-500
absolute
w-6
h-6
top-1
left-1
mt-16
lg:flex-row
w-full
max-w-sm
p-12
flex-shrink-0
text-4xl
text-green-500
pb-6
border-b
flex-1
text-green-300
ml-3
pt-4
max-w-xs
hover:bg-indigo-500
hover:text-white
fixed
bottom-5
left-5
text-blue-500
text-black
63 steps to build a Pricing page component with Tailwind CSS
Control the horizontal margin of an element to auto using the
mx-auto
utilities.Control the text color of an element to gray-900 using the
text-gray-900
utilities.Control the background color of an element to white using the
bg-white
utilities.Use
flex
to create a block-level flex container.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Control the vertical padding of an element to 0.5rem using the
py-2
utilities.Use
justify-start
to justify items against the start of the container’s main axis.Use
w-1/4
to set an element to a fixed width(1/4).Control the text color of an element to 2xl using the
text-2xl
utilities.Control the text color of an element to indigo-500 using the
text-indigo-500
utilities.Use
inline-flex
to create an inline flex container that flows with text.Control the text color of an element to gray-400 using the
text-gray-400
utilities.Use
hidden
to set an element to display: none and remove it from the page layout at only large screen sizes.Use
w-8
to set an element to a fixed width(2rem).Use
h-8
to set an element to a fixed height(2rem).Use
hidden
to set an element to display: none and remove it from the page layout.Use
w-1/2
to set an element to a fixed width(1/2).Use
flex
to create a block-level flex container at only large screen sizes.Control the text color of an element to base using the
text-base
utilities.Control the text color of an element to gray-900 on hover using the
hover:text-gray-900
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the text color of an element to white using the
text-white
utilities.Control the background color of an element to indigo-600 using the
bg-indigo-600
utilities.Control the border color of an element to transparent using the
border-transparent
utilities.Control the background color of an element to indigo-700 using the
hover:bg-indigo-700
utilities on hover.Use
flex
to create a block-level flex container.Control the horizontal margin of an element to 1rem using the
mx-4
utilities.Control the vertical margin of an element to 4rem using the
my-16
utilities.Control the text color of an element to center using the
text-center
utilities.Control the margin on bottom side of an element to 1rem using the
mb-4
utilities.Control the text color of an element to 3xl at only medium screen sizes using the
md:text-3xl
utilities.Control the text color of an element to 4xl at only large screen sizes using the
lg:text-4xl
utilities.Control the margin on top side of an element to 2.5rem using the
mt-10
utilities.Use
relative
to position an element according to the normal flow of the document.Use
w-16
to set an element to a fixed width(4rem).Control the background color of an element to indigo-500 using the
bg-indigo-500
utilities.Use
absolute
to position an element outside of the normal flow of the document, causing neighboring elements to act as if the element doesn’t exist.Use
w-6
to set an element to a fixed width(1.5rem).Use
h-6
to set an element to a fixed height(1.5rem).Use the
top-1
utilities to set the top position of a positioned element to 0.25rem.Use the
left-1
utilities to set the left position of a positioned element to 0.25rem.Control the margin on top side of an element to 4rem using the
mt-16
utilities.Use
flex
to create a block-level flex container at only large screen sizes.Use
w-full
to set an element to a 100% based width.Set the maximum width/height of an element using the
max-w-sm
utilities.Control the padding on all sides of an element to 3rem using the
p-12
utilities.Use
flex
to create a block-level flex container.Control the text color of an element to 4xl using the
text-4xl
utilities.Control the text color of an element to green-500 using the
text-green-500
utilities.Control the padding on bottom side of an element to 1.5rem using the
pb-6
utilities.Control the border color of an element to b using the
border-b
utilities.Use
flex
to create a block-level flex container.Control the text color of an element to green-300 using the
text-green-300
utilities.Control the margin on left side of an element to 0.75rem using the
ml-3
utilities.Control the padding on top side of an element to 1rem using the
pt-4
utilities.Set the maximum width/height of an element using the
max-w-xs
utilities.Control the background color of an element to indigo-500 using the
hover:bg-indigo-500
utilities on hover.Control the text color of an element to white on hover using the
hover:text-white
utilities.Use
fixed
to position an element relative to the browser window.Use the
bottom-5
utilities to set the bottom position of a positioned element to 1.25rem.Use the
left-5
utilities to set the left position of a positioned element to 1.25rem.Control the text color of an element to blue-500 using the
text-blue-500
utilities.Control the text color of an element to black using the
text-black
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a Pricing page components, learn and follow along to implement your own components.