Pricing
pricing-07
Two pricing cards: plan name and description, price and yearly note, a button, then a checked feature list below a divider.
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
A plan is ['name', 'description', 'price', 'period', 'note', 'features',
'buttonLabel', 'buttonHref']. Leave buttonHref out and the button stays a
plain button.
<x-ui.blocks.pricing-07
heading="Simple pricing"
:plans="[
[
'name' => 'Solo',
'description' => 'For one person',
'price' => '$9',
'period' => '/mo',
'note' => 'or $90 yearly',
'features' => ['1 seat', 'Email support'],
'buttonHref' => '/register',
],
[
'name' => 'Team',
'description' => 'For growing teams',
'price' => '$29',
'period' => '/mo',
'note' => 'or $290 yearly',
'features' => ['20 seats', 'Priority support', 'SSO'],
'buttonHref' => '/register?plan=team',
],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'plans' => [
[
'name' => 'Basic plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$19',
'period' => '/mo',
'note' => 'or $199 yearly',
'features' => ['Feature text goes here', 'Feature text goes here', 'Feature text goes here'],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$29',
'period' => '/mo',
'note' => 'or $299 yearly',
'features' => [
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
])
<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>
<div class="mx-auto grid max-w-5xl grid-cols-1 gap-8 md:grid-cols-2">
@foreach ($plans as $plan)
<x-ui.card class="py-6 md:py-8 md:[&>div]:px-8">
<h3 class="text-lg font-bold leading-[1.4] md:text-xl">{{ $plan['name'] ?? '' }}</h3>
<p>{{ $plan['description'] ?? '' }}</p>
<x-ui.separator class="my-6 md:my-8" />
<p class="font-bold">
<span class="text-[2.5rem] leading-[1.2] md:text-[3.5rem]">{{ $plan['price'] ?? '' }}</span><span
class="text-2xl leading-[1.4]">{{ $plan['period'] ?? '' }}</span>
</p>
@if (!empty($plan['note']))
<p class="mt-2">{{ $plan['note'] }}</p>
@endif
<x-ui.button :href="$plan['buttonHref'] ?? null" size="lg"
class="mt-6 w-full md:mt-8">{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
<x-ui.separator class="my-6 md:my-8" />
<ul class="flex flex-col gap-4 py-2">
@foreach ($plan['features'] ?? [] as $feature)
<li class="flex items-start gap-4">
<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="size-6 shrink-0" aria-hidden="true">
<path d="M20 6 9 17l-5-5" />
</svg>
<span>{{ $feature }}</span>
</li>
@endforeach
</ul>
</x-ui.card>
@endforeach
</div>
</div>
</section>
Installation
php artisan ui:add-block pricing-07
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-07
/>.
1. Install component dependencies
php artisan ui:add button card separator
2. External packages
- composer:
gehrisandro/tailwind-merge-laravel
3.
Copy the block source into
resources/views/components/ui/
resources/views/components/ui/blocks/pricing-07.blade.php
{{--
Every piece of content is a prop, so you can drive this section from a CMS.
A plan is ['name', 'description', 'price', 'period', 'note', 'features',
'buttonLabel', 'buttonHref']. Leave buttonHref out and the button stays a
plain button.
<x-ui.blocks.pricing-07
heading="Simple pricing"
:plans="[
[
'name' => 'Solo',
'description' => 'For one person',
'price' => '$9',
'period' => '/mo',
'note' => 'or $90 yearly',
'features' => ['1 seat', 'Email support'],
'buttonHref' => '/register',
],
[
'name' => 'Team',
'description' => 'For growing teams',
'price' => '$29',
'period' => '/mo',
'note' => 'or $290 yearly',
'features' => ['20 seats', 'Priority support', 'SSO'],
'buttonHref' => '/register?plan=team',
],
]"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Pricing plan',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'plans' => [
[
'name' => 'Basic plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$19',
'period' => '/mo',
'note' => 'or $199 yearly',
'features' => ['Feature text goes here', 'Feature text goes here', 'Feature text goes here'],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$29',
'period' => '/mo',
'note' => 'or $299 yearly',
'features' => [
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
])
<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>
<div class="mx-auto grid max-w-5xl grid-cols-1 gap-8 md:grid-cols-2">
@foreach ($plans as $plan)
<x-ui.card class="py-6 md:py-8 md:[&>div]:px-8">
<h3 class="text-lg font-bold leading-[1.4] md:text-xl">{{ $plan['name'] ?? '' }}</h3>
<p>{{ $plan['description'] ?? '' }}</p>
<x-ui.separator class="my-6 md:my-8" />
<p class="font-bold">
<span class="text-[2.5rem] leading-[1.2] md:text-[3.5rem]">{{ $plan['price'] ?? '' }}</span><span
class="text-2xl leading-[1.4]">{{ $plan['period'] ?? '' }}</span>
</p>
@if (!empty($plan['note']))
<p class="mt-2">{{ $plan['note'] }}</p>
@endif
<x-ui.button :href="$plan['buttonHref'] ?? null" size="lg"
class="mt-6 w-full md:mt-8">{{ $plan['buttonLabel'] ?? 'Get started' }}</x-ui.button>
<x-ui.separator class="my-6 md:my-8" />
<ul class="flex flex-col gap-4 py-2">
@foreach ($plan['features'] ?? [] as $feature)
<li class="flex items-start gap-4">
<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="size-6 shrink-0" aria-hidden="true">
<path d="M20 6 9 17l-5-5" />
</svg>
<span>{{ $feature }}</span>
</li>
@endforeach
</ul>
</x-ui.card>
@endforeach
</div>
</div>
</section>
Usage
Every piece of content is a prop, so you can drive this section from a CMS. A plan is ['name', 'description', 'price', 'period', 'note', 'features', 'buttonLabel', 'buttonHref']. Leave buttonHref out and the button stays a plain button.
<x-ui.blocks.pricing-07
heading="Simple pricing"
:plans="[
[
'name' => 'Solo',
'description' => 'For one person',
'price' => '$9',
'period' => '/mo',
'note' => 'or $90 yearly',
'features' => ['1 seat', 'Email support'],
'buttonHref' => '/register',
],
[
'name' => 'Team',
'description' => 'For growing teams',
'price' => '$29',
'period' => '/mo',
'note' => 'or $290 yearly',
'features' => ['20 seats', 'Priority support', 'SSO'],
'buttonHref' => '/register?plan=team',
],
]"
/>
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 plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$19',
'period' => '/mo',
'note' => 'or $199 yearly',
'features' => ['Feature text goes here', 'Feature text goes here', 'Feature text goes here'],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
[
'name' => 'Business plan',
'description' => 'Lorem ipsum dolor sit amet',
'price' => '$29',
'period' => '/mo',
'note' => 'or $299 yearly',
'features' => [
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
'Feature text goes here',
],
'buttonLabel' => 'Get started',
'buttonHref' => null,
],
],
])