Pricing
pricing-17
Borderless feature comparison table with centred plan headers, grouped rows, repeated buttons and Monthly / Yearly tabs.
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
Each plan carries a monthly price (price + period) and a yearly one
(yearlyPrice + yearlyPeriod); the Monthly / Yearly tabs swap between them.
A comparison row is ['label' => ..., 'values' => [...]] with 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. The plan
buttons repeat under the table.
<x-ui.blocks.pricing-17
tagline="Pricing"
heading="Compare plans"
description="Every plan includes SSL and daily backups."
:plans="[
['name' => 'Starter', 'price' => '$9', 'period' => '/mo', 'yearlyPrice' => '$90', 'yearlyPeriod' => '/yr', 'description' => 'For side projects', 'buttonLabel' => 'Start free', 'buttonHref' => '/register'],
['name' => 'Team', 'price' => '$29', 'period' => '/mo', 'yearlyPrice' => '$290', 'yearlyPeriod' => '/yr', 'description' => 'For growing teams', 'buttonLabel' => 'Choose Team', 'buttonHref' => '/register?plan=team'],
]"
:categories="[
['title' => 'Usage', 'features' => [
['label' => 'Projects', 'values' => ['3', 'Unlimited']],
['label' => 'Custom domains', 'values' => [false, true]],
]],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'monthlyLabel' => 'Monthly',
'yearlyLabel' => 'Yearly',
'includedLabel' => 'Included',
'notIncludedLabel' => 'Not included',
'plans' => [
[
'name' => 'Basic',
'price' => '$19',
'period' => '/mo',
'yearlyPrice' => '$199',
'yearlyPeriod' => '/yr',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business',
'price' => '$29',
'period' => '/mo',
'yearlyPrice' => '$299',
'yearlyPeriod' => '/yr',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Enterprise',
'price' => '$49',
'period' => '/mo',
'yearlyPrice' => '$499',
'yearlyPeriod' => '/yr',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
'categories' => array_fill(0, 3, [
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25', 'Unlimited']],
['label' => 'Feature text goes here', 'values' => [true, true, true]],
['label' => 'Feature text goes here', 'values' => [true, true, true]],
['label' => 'Feature text goes here', 'values' => [false, true, true]],
['label' => 'Feature text goes here', 'values' => [false, false, true]],
],
]),
])
<section {{ $attributes->merge(['class' => 'w-full 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 flex max-w-3xl flex-col items-center gap-3 text-center md:mb-20 md:gap-4">
@if ($tagline)
<p class="font-semibold">{{ $tagline }}</p>
@endif
<div class="flex flex-col gap-5 md:gap-6">
<h2 class="text-4xl font-bold leading-[1.2] md:text-5xl">{{ $heading }}</h2>
@if ($description)
<p class="text-muted-foreground md:text-lg">{{ $description }}</p>
@endif
</div>
</div>
<x-ui.tabs :tabs="['monthly' => $monthlyLabel, 'yearly' => $yearlyLabel]" class="mb-6 self-center md:mb-10">
@foreach (['monthly', 'yearly'] as $billing)
<x-slot :name="'tab_' . $billing">
{{-- On mobile the feature label gets a row of its own above
the values, so the plan columns keep the full width. --}}
<x-ui.table class="table-fixed">
<thead>
<tr>
<td class="hidden md:table-cell md:w-1/3"></td>
@foreach ($plans as $plan)
<th scope="col"
class="px-1 pb-6 text-center align-top font-normal md:px-2 md:pb-8">
<div class="flex h-full flex-col items-center">
<span class="text-sm font-bold md:text-xl">{{ $plan['name'] ?? '' }}</span>
<span dir="ltr" class="mt-1 whitespace-nowrap font-bold md:mt-2"><span
class="text-lg leading-[1.2] md:text-5xl">{{ $billing === 'yearly' ? $plan['yearlyPrice'] ?? '' : $plan['price'] ?? '' }}</span><span
class="text-xs md:text-2xl">{{ $billing === 'yearly' ? $plan['yearlyPeriod'] ?? '' : $plan['period'] ?? '' }}</span></span>
@if (!empty($plan['description']))
<span class="mt-2 text-xs text-muted-foreground md:mt-4 md:text-base">
{{ $plan['description'] }}</span>
@endif
<x-ui.button :href="$plan['buttonHref'] ?? null"
class="mt-4 w-full px-2 md:mt-6 md:h-10">
{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
</div>
</th>
@endforeach
</tr>
</thead>
@foreach ($categories as $category)
<tbody>
<tr>
<th colspan="{{ count($plans) }}" scope="colgroup"
class="pt-8 pb-4 text-start text-base font-bold md:text-xl">
{{ $category['title'] ?? '' }}</th>
{{-- Keeps the row as wide as the table on desktop without adding a
phantom column on mobile, where the label column is hidden. --}}
<td class="hidden md:table-cell"></td>
</tr>
@foreach ($category['features'] ?? [] as $feature)
<tr class="md:hidden">
<td colspan="{{ count($plans) }}" class="px-2 pt-4 pb-2">{{ $feature['label'] ?? '' }}</td>
</tr>
<tr>
<th scope="row" class="hidden py-4 ps-6 pe-6 text-start font-normal md:table-cell">
{{ $feature['label'] ?? '' }}</th>
@foreach ($plans as $i => $plan)
@php($value = $feature['values'][$i] ?? null)
<td
class="px-2 py-2 text-center font-semibold md:px-6 md:py-4">
@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">{{ $notIncludedLabel }}</span>
@else
{{ $value }}
@endif
</td>
@endforeach
</tr>
@endforeach
</tbody>
@endforeach
<tfoot>
<tr>
<td class="hidden md:table-cell"></td>
@foreach ($plans as $plan)
<td class="px-1 pt-8 md:px-2">
<x-ui.button :href="$plan['buttonHref'] ?? null"
class="w-full px-2 md:h-10">{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
</td>
@endforeach
</tr>
</tfoot>
</x-ui.table>
</x-slot>
@endforeach
</x-ui.tabs>
</div>
</section>
Installation
php artisan ui:add-block pricing-17
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-17
/>.
1. Install component dependencies
php artisan ui:add button table tabs
2. External packages
- composer:
gehrisandro/tailwind-merge-laravel
3.
Copy the block source into
resources/views/components/ui/
resources/views/components/ui/blocks/pricing-17.blade.php
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
Each plan carries a monthly price (price + period) and a yearly one
(yearlyPrice + yearlyPeriod); the Monthly / Yearly tabs swap between them.
A comparison row is ['label' => ..., 'values' => [...]] with 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. The plan
buttons repeat under the table.
<x-ui.blocks.pricing-17
tagline="Pricing"
heading="Compare plans"
description="Every plan includes SSL and daily backups."
:plans="[
['name' => 'Starter', 'price' => '$9', 'period' => '/mo', 'yearlyPrice' => '$90', 'yearlyPeriod' => '/yr', 'description' => 'For side projects', 'buttonLabel' => 'Start free', 'buttonHref' => '/register'],
['name' => 'Team', 'price' => '$29', 'period' => '/mo', 'yearlyPrice' => '$290', 'yearlyPeriod' => '/yr', 'description' => 'For growing teams', 'buttonLabel' => 'Choose Team', 'buttonHref' => '/register?plan=team'],
]"
:categories="[
['title' => 'Usage', 'features' => [
['label' => 'Projects', 'values' => ['3', 'Unlimited']],
['label' => 'Custom domains', 'values' => [false, true]],
]],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'monthlyLabel' => 'Monthly',
'yearlyLabel' => 'Yearly',
'includedLabel' => 'Included',
'notIncludedLabel' => 'Not included',
'plans' => [
[
'name' => 'Basic',
'price' => '$19',
'period' => '/mo',
'yearlyPrice' => '$199',
'yearlyPeriod' => '/yr',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business',
'price' => '$29',
'period' => '/mo',
'yearlyPrice' => '$299',
'yearlyPeriod' => '/yr',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Enterprise',
'price' => '$49',
'period' => '/mo',
'yearlyPrice' => '$499',
'yearlyPeriod' => '/yr',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
'categories' => array_fill(0, 3, [
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25', 'Unlimited']],
['label' => 'Feature text goes here', 'values' => [true, true, true]],
['label' => 'Feature text goes here', 'values' => [true, true, true]],
['label' => 'Feature text goes here', 'values' => [false, true, true]],
['label' => 'Feature text goes here', 'values' => [false, false, true]],
],
]),
])
<section {{ $attributes->merge(['class' => 'w-full 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 flex max-w-3xl flex-col items-center gap-3 text-center md:mb-20 md:gap-4">
@if ($tagline)
<p class="font-semibold">{{ $tagline }}</p>
@endif
<div class="flex flex-col gap-5 md:gap-6">
<h2 class="text-4xl font-bold leading-[1.2] md:text-5xl">{{ $heading }}</h2>
@if ($description)
<p class="text-muted-foreground md:text-lg">{{ $description }}</p>
@endif
</div>
</div>
<x-ui.tabs :tabs="['monthly' => $monthlyLabel, 'yearly' => $yearlyLabel]" class="mb-6 self-center md:mb-10">
@foreach (['monthly', 'yearly'] as $billing)
<x-slot :name="'tab_' . $billing">
{{-- On mobile the feature label gets a row of its own above
the values, so the plan columns keep the full width. --}}
<x-ui.table class="table-fixed">
<thead>
<tr>
<td class="hidden md:table-cell md:w-1/3"></td>
@foreach ($plans as $plan)
<th scope="col"
class="px-1 pb-6 text-center align-top font-normal md:px-2 md:pb-8">
<div class="flex h-full flex-col items-center">
<span class="text-sm font-bold md:text-xl">{{ $plan['name'] ?? '' }}</span>
<span dir="ltr" class="mt-1 whitespace-nowrap font-bold md:mt-2"><span
class="text-lg leading-[1.2] md:text-5xl">{{ $billing === 'yearly' ? $plan['yearlyPrice'] ?? '' : $plan['price'] ?? '' }}</span><span
class="text-xs md:text-2xl">{{ $billing === 'yearly' ? $plan['yearlyPeriod'] ?? '' : $plan['period'] ?? '' }}</span></span>
@if (!empty($plan['description']))
<span class="mt-2 text-xs text-muted-foreground md:mt-4 md:text-base">
{{ $plan['description'] }}</span>
@endif
<x-ui.button :href="$plan['buttonHref'] ?? null"
class="mt-4 w-full px-2 md:mt-6 md:h-10">
{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
</div>
</th>
@endforeach
</tr>
</thead>
@foreach ($categories as $category)
<tbody>
<tr>
<th colspan="{{ count($plans) }}" scope="colgroup"
class="pt-8 pb-4 text-start text-base font-bold md:text-xl">
{{ $category['title'] ?? '' }}</th>
{{-- Keeps the row as wide as the table on desktop without adding a
phantom column on mobile, where the label column is hidden. --}}
<td class="hidden md:table-cell"></td>
</tr>
@foreach ($category['features'] ?? [] as $feature)
<tr class="md:hidden">
<td colspan="{{ count($plans) }}" class="px-2 pt-4 pb-2">{{ $feature['label'] ?? '' }}</td>
</tr>
<tr>
<th scope="row" class="hidden py-4 ps-6 pe-6 text-start font-normal md:table-cell">
{{ $feature['label'] ?? '' }}</th>
@foreach ($plans as $i => $plan)
@php($value = $feature['values'][$i] ?? null)
<td
class="px-2 py-2 text-center font-semibold md:px-6 md:py-4">
@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">{{ $notIncludedLabel }}</span>
@else
{{ $value }}
@endif
</td>
@endforeach
</tr>
@endforeach
</tbody>
@endforeach
<tfoot>
<tr>
<td class="hidden md:table-cell"></td>
@foreach ($plans as $plan)
<td class="px-1 pt-8 md:px-2">
<x-ui.button :href="$plan['buttonHref'] ?? null"
class="w-full px-2 md:h-10">{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
</td>
@endforeach
</tr>
</tfoot>
</x-ui.table>
</x-slot>
@endforeach
</x-ui.tabs>
</div>
</section>
Usage
Every piece of content is a prop, so you can drive this section from a CMS. Each plan carries a monthly price (price + period) and a yearly one (yearlyPrice + yearlyPeriod); the Monthly / Yearly tabs swap between them. A comparison row is ['label' => ..., 'values' => [...]] with 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. The plan buttons repeat under the table.
<x-ui.blocks.pricing-17
tagline="Pricing"
heading="Compare plans"
description="Every plan includes SSL and daily backups."
:plans="[
['name' => 'Starter', 'price' => '$9', 'period' => '/mo', 'yearlyPrice' => '$90', 'yearlyPeriod' => '/yr', 'description' => 'For side projects', 'buttonLabel' => 'Start free', 'buttonHref' => '/register'],
['name' => 'Team', 'price' => '$29', 'period' => '/mo', 'yearlyPrice' => '$290', 'yearlyPeriod' => '/yr', 'description' => 'For growing teams', 'buttonLabel' => 'Choose Team', 'buttonHref' => '/register?plan=team'],
]"
:categories="[
['title' => 'Usage', 'features' => [
['label' => 'Projects', 'values' => ['3', 'Unlimited']],
['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.',
'monthlyLabel' => 'Monthly',
'yearlyLabel' => 'Yearly',
'includedLabel' => 'Included',
'notIncludedLabel' => 'Not included',
'plans' => [
[
'name' => 'Basic',
'price' => '$19',
'period' => '/mo',
'yearlyPrice' => '$199',
'yearlyPeriod' => '/yr',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business',
'price' => '$29',
'period' => '/mo',
'yearlyPrice' => '$299',
'yearlyPeriod' => '/yr',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Enterprise',
'price' => '$49',
'period' => '/mo',
'yearlyPrice' => '$499',
'yearlyPeriod' => '/yr',
'description' => 'Lorem ipsum dolor sit amet',
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
'categories' => array_fill(0, 3, [
'title' => 'Feature Category',
'features' => [
['label' => 'Feature text goes here', 'values' => ['10', '25', 'Unlimited']],
['label' => 'Feature text goes here', 'values' => [true, true, true]],
['label' => 'Feature text goes here', 'values' => [true, true, true]],
['label' => 'Feature text goes here', 'values' => [false, true, true]],
['label' => 'Feature text goes here', 'values' => [false, false, true]],
],
]),
])