Pricing
pricing-02
Two-plan comparison table: plan headers with price and button, then feature rows grouped by category with checks or values in bordered cells.
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
A plan is ['name', 'price', 'period', 'description', 'buttonLabel',
'buttonHref']. Each feature row carries one value per plan, in plan order:
true draws a check, false or null leaves the cell empty, and a string
('10', 'Unlimited') is printed as is.
<x-ui.blocks.pricing-02
heading="Compare plans"
:plans="[
['name' => 'Starter', 'price' => '$9', 'period' => 'Per month', 'buttonHref' => '/register'],
['name' => 'Team', 'price' => '$29', 'period' => 'Per month', 'buttonHref' => '/register?plan=team'],
]"
:categories="[
['title' => 'Usage', 'features' => [
['label' => 'Seats', 'values' => ['3', '20']],
['label' => 'Custom domains', 'values' => [false, true]],
]],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'plans' => [
[
'name' => 'Basic',
'price' => '$19',
'period' => 'Per month',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business',
'price' => '$29',
'period' => 'Per month',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
'categories' => [
[
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25']],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [false, true]],
],
],
[
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25']],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [false, true]],
],
],
[
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25']],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [false, true]],
],
],
],
'includedLabel' => 'Included',
'excludedLabel' => 'Not included',
])
@php
// The label column is hidden on phones, where each feature gets a
// full-width row of its own above its values. A colspan wider than the
// visible columns would add an empty column, so phones span one less.
$span = count($plans) + 1;
@endphp
<section {{ $attributes->merge(['class' => 'bg-background px-[5%] py-16 text-foreground md:py-24 lg:py-28']) }}>
<div class="mx-auto max-w-7xl">
<div class="mx-auto mb-12 max-w-3xl text-center md:mb-20">
<p class="mb-3 font-semibold md:mb-4">{{ $tagline }}</p>
<h2 class="mb-5 text-4xl font-bold leading-[1.2] md:mb-6 md:text-5xl">{{ $heading }}</h2>
<p class="md:text-lg">{{ $description }}</p>
</div>
<x-ui.table class="table-fixed text-xs md:text-base">
<thead>
<tr class="border-b border-border">
<td class="hidden md:table-cell md:w-1/3"></td>
@foreach ($plans as $plan)
<th scope="col"
class="{{ $loop->first ? 'md:border-s' : 'border-s' }} border-border px-1 pb-4 text-start align-top font-normal md:px-4 md:pb-6">
<div class="flex h-full flex-col gap-1 md:gap-2">
<span class="text-sm font-bold md:text-xl">{{ $plan['name'] ?? '' }}</span>
<span class="text-base font-bold leading-[1.2] md:text-5xl">{{ $plan['price'] ?? '' }}</span>
<span class="font-bold">{{ $plan['period'] ?? '' }}</span>
<span class="mt-2 md:mt-4">{{ $plan['description'] ?? '' }}</span>
<x-ui.button :href="$plan['buttonHref'] ?? null" size="lg"
class="mt-3 w-full px-2 md:mt-6">{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
</div>
</th>
@endforeach
</tr>
</thead>
@foreach ($categories as $category)
<tbody>
<tr class="border-b border-border md:hidden">
<th scope="colgroup" colspan="{{ $span - 1 }}"
class="py-4 text-start text-sm font-bold md:text-xl">{{ $category['title'] ?? '' }}</th>
</tr>
<tr class="border-b border-border hidden md:table-row">
<th scope="colgroup" colspan="{{ $span }}"
class="py-4 text-start text-sm font-bold md:text-xl">{{ $category['title'] ?? '' }}</th>
</tr>
@foreach ($category['features'] ?? [] as $feature)
<tr class="border-b border-border md:hidden">
<td colspan="{{ $span - 1 }}" class="py-4">{{ $feature['label'] ?? '' }}</td>
</tr>
<tr class="border-b border-border">
<th scope="row" class="hidden py-4 pe-4 text-start font-normal md:table-cell">
{{ $feature['label'] ?? '' }}</th>
@foreach ($feature['values'] ?? [] as $value)
<td
class="{{ $loop->first ? 'md:border-s' : 'border-s' }} border-border px-2 py-4 text-center">
@if ($value === true)
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="mx-auto size-5 md:size-6"
aria-hidden="true">
<path d="M20 6 9 17l-5-5" />
</svg>
<span class="sr-only">{{ $includedLabel }}</span>
@elseif ($value === false || $value === null)
<span class="sr-only">{{ $excludedLabel }}</span>
@else
<span class="font-semibold">{{ $value }}</span>
@endif
</td>
@endforeach
</tr>
@endforeach
</tbody>
@endforeach
</x-ui.table>
</div>
</section>
Installation
php artisan ui:add-block pricing-02
A single command installs the block's Blade file and every component it depends on. Render it in your own layout as
<x-ui.blocks.pricing-02
/>.
1. Install component dependencies
php artisan ui:add button table
2. External packages
- composer:
gehrisandro/tailwind-merge-laravel
3.
Copy the block source into
resources/views/components/ui/
resources/views/components/ui/blocks/pricing-02.blade.php
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
A plan is ['name', 'price', 'period', 'description', 'buttonLabel',
'buttonHref']. Each feature row carries one value per plan, in plan order:
true draws a check, false or null leaves the cell empty, and a string
('10', 'Unlimited') is printed as is.
<x-ui.blocks.pricing-02
heading="Compare plans"
:plans="[
['name' => 'Starter', 'price' => '$9', 'period' => 'Per month', 'buttonHref' => '/register'],
['name' => 'Team', 'price' => '$29', 'period' => 'Per month', 'buttonHref' => '/register?plan=team'],
]"
:categories="[
['title' => 'Usage', 'features' => [
['label' => 'Seats', 'values' => ['3', '20']],
['label' => 'Custom domains', 'values' => [false, true]],
]],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'plans' => [
[
'name' => 'Basic',
'price' => '$19',
'period' => 'Per month',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business',
'price' => '$29',
'period' => 'Per month',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
'categories' => [
[
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25']],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [false, true]],
],
],
[
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25']],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [false, true]],
],
],
[
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25']],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [false, true]],
],
],
],
'includedLabel' => 'Included',
'excludedLabel' => 'Not included',
])
@php
// The label column is hidden on phones, where each feature gets a
// full-width row of its own above its values. A colspan wider than the
// visible columns would add an empty column, so phones span one less.
$span = count($plans) + 1;
@endphp
<section {{ $attributes->merge(['class' => 'bg-background px-[5%] py-16 text-foreground md:py-24 lg:py-28']) }}>
<div class="mx-auto max-w-7xl">
<div class="mx-auto mb-12 max-w-3xl text-center md:mb-20">
<p class="mb-3 font-semibold md:mb-4">{{ $tagline }}</p>
<h2 class="mb-5 text-4xl font-bold leading-[1.2] md:mb-6 md:text-5xl">{{ $heading }}</h2>
<p class="md:text-lg">{{ $description }}</p>
</div>
<x-ui.table class="table-fixed text-xs md:text-base">
<thead>
<tr class="border-b border-border">
<td class="hidden md:table-cell md:w-1/3"></td>
@foreach ($plans as $plan)
<th scope="col"
class="{{ $loop->first ? 'md:border-s' : 'border-s' }} border-border px-1 pb-4 text-start align-top font-normal md:px-4 md:pb-6">
<div class="flex h-full flex-col gap-1 md:gap-2">
<span class="text-sm font-bold md:text-xl">{{ $plan['name'] ?? '' }}</span>
<span class="text-base font-bold leading-[1.2] md:text-5xl">{{ $plan['price'] ?? '' }}</span>
<span class="font-bold">{{ $plan['period'] ?? '' }}</span>
<span class="mt-2 md:mt-4">{{ $plan['description'] ?? '' }}</span>
<x-ui.button :href="$plan['buttonHref'] ?? null" size="lg"
class="mt-3 w-full px-2 md:mt-6">{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
</div>
</th>
@endforeach
</tr>
</thead>
@foreach ($categories as $category)
<tbody>
<tr class="border-b border-border md:hidden">
<th scope="colgroup" colspan="{{ $span - 1 }}"
class="py-4 text-start text-sm font-bold md:text-xl">{{ $category['title'] ?? '' }}</th>
</tr>
<tr class="border-b border-border hidden md:table-row">
<th scope="colgroup" colspan="{{ $span }}"
class="py-4 text-start text-sm font-bold md:text-xl">{{ $category['title'] ?? '' }}</th>
</tr>
@foreach ($category['features'] ?? [] as $feature)
<tr class="border-b border-border md:hidden">
<td colspan="{{ $span - 1 }}" class="py-4">{{ $feature['label'] ?? '' }}</td>
</tr>
<tr class="border-b border-border">
<th scope="row" class="hidden py-4 pe-4 text-start font-normal md:table-cell">
{{ $feature['label'] ?? '' }}</th>
@foreach ($feature['values'] ?? [] as $value)
<td
class="{{ $loop->first ? 'md:border-s' : 'border-s' }} border-border px-2 py-4 text-center">
@if ($value === true)
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="mx-auto size-5 md:size-6"
aria-hidden="true">
<path d="M20 6 9 17l-5-5" />
</svg>
<span class="sr-only">{{ $includedLabel }}</span>
@elseif ($value === false || $value === null)
<span class="sr-only">{{ $excludedLabel }}</span>
@else
<span class="font-semibold">{{ $value }}</span>
@endif
</td>
@endforeach
</tr>
@endforeach
</tbody>
@endforeach
</x-ui.table>
</div>
</section>
Usage
Every piece of content is a prop, so you can drive this section from a CMS. A plan is ['name', 'price', 'period', 'description', 'buttonLabel', 'buttonHref']. Each feature row carries one value per plan, in plan order: true draws a check, false or null leaves the cell empty, and a string ('10', 'Unlimited') is printed as is.
<x-ui.blocks.pricing-02
heading="Compare plans"
:plans="[
['name' => 'Starter', 'price' => '$9', 'period' => 'Per month', 'buttonHref' => '/register'],
['name' => 'Team', 'price' => '$29', 'period' => 'Per month', 'buttonHref' => '/register?plan=team'],
]"
:categories="[
['title' => 'Usage', 'features' => [
['label' => 'Seats', 'values' => ['3', '20']],
['label' => 'Custom domains', 'values' => [false, true]],
]],
]"
/>
Props
Every prop with its default. Pass any of them as attributes, using : to bind a PHP value.
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'plans' => [
[
'name' => 'Basic',
'price' => '$19',
'period' => 'Per month',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business',
'price' => '$29',
'period' => 'Per month',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
'categories' => [
[
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25']],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [false, true]],
],
],
[
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25']],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [false, true]],
],
],
[
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25']],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [true, true]],
['label' => 'Feature text goes here', 'values' => [false, true]],
],
],
],
'includedLabel' => 'Included',
'excludedLabel' => 'Not included',
])