--- title: "pricing-08" description: "Four-plan comparison table with a monthly\/yearly switch (tabs): bordered plan headers, then feature rows grouped by category." category: "Pricing" --- # pricing-08 Four-plan comparison table with a monthly/yearly switch (tabs): bordered plan headers, then feature rows grouped by category. ## Installation ```bash php artisan ui:add-block pricing-08 ``` ## Dependencies - composer: `gehrisandro/tailwind-merge-laravel` - component: [button](https://laralcn-ui.abdulkadersafi.com/components/button.md) — the CLI installs it for you. - component: [table](https://laralcn-ui.abdulkadersafi.com/components/table.md) — the CLI installs it for you. - component: [tabs](https://laralcn-ui.abdulkadersafi.com/components/tabs.md) — the CLI installs it for you. ## Source `resources/views/components/ui/blocks/pricing-08.blade.php` ```blade {{-- Every piece of content is a prop, so you can drive this section from a CMS. periods labels the switch (key => label), and plans holds one list of plans per period key. A plan is ['name', 'price', 'period', 'description', 'buttonLabel', 'buttonHref']. The switch is the tabs component, so each period renders its own copy of the table. 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. --}} @props([ 'tagline' => 'Tagline', 'heading' => 'Pricing plan', 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'periods' => ['monthly' => 'Monthly', 'yearly' => 'Yearly'], 'plans' => [ 'monthly' => [ [ 'name' => 'Free', 'price' => '$0', 'period' => 'Per month', 'description' => 'Lorem ipsum dolor sit amet', 'buttonLabel' => 'Get started', 'buttonHref' => null, ], [ '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, ], [ 'name' => 'Enterprise', 'price' => '$49', 'period' => 'Per month', 'description' => 'Lorem ipsum dolor sit amet', 'buttonLabel' => 'Get started', 'buttonHref' => null, ], ], 'yearly' => [ [ 'name' => 'Free', 'price' => '$0', 'period' => 'Per year', 'description' => 'Lorem ipsum dolor sit amet', 'buttonLabel' => 'Get started', 'buttonHref' => null, ], [ 'name' => 'Basic', 'price' => '$190', 'period' => 'Per year', 'description' => 'Lorem ipsum dolor sit amet', 'buttonLabel' => 'Get started', 'buttonHref' => null, ], [ 'name' => 'Business', 'price' => '$290', 'period' => 'Per year', 'description' => 'Lorem ipsum dolor sit amet', 'buttonLabel' => 'Get started', 'buttonHref' => null, ], [ 'name' => 'Enterprise', 'price' => '$490', 'period' => 'Per year', 'description' => 'Lorem ipsum dolor sit amet', 'buttonLabel' => 'Get started', 'buttonHref' => null, ], ], ], 'categories' => [ [ 'title' => 'Feature Category', 'features' => [ ['label' => 'Feature text goes here', 'values' => ['10', '10', '25', 'Unlimited']], ['label' => 'Feature text goes here', 'values' => [true, true, true, true]], ['label' => 'Feature text goes here', 'values' => [true, true, true, true]], ['label' => 'Feature text goes here', 'values' => [false, false, true, true]], ['label' => 'Feature text goes here', 'values' => [false, false, false, true]], ], ], [ 'title' => 'Feature Category', 'features' => [ ['label' => 'Feature text goes here', 'values' => ['10', '10', '25', 'Unlimited']], ['label' => 'Feature text goes here', 'values' => [true, true, true, true]], ['label' => 'Feature text goes here', 'values' => [true, true, true, true]], ['label' => 'Feature text goes here', 'values' => [false, false, true, true]], ['label' => 'Feature text goes here', 'values' => [false, false, false, true]], ], ], [ 'title' => 'Feature Category', 'features' => [ ['label' => 'Feature text goes here', 'values' => ['10', '10', '25', 'Unlimited']], ['label' => 'Feature text goes here', 'values' => [true, true, true, true]], ['label' => 'Feature text goes here', 'values' => [true, true, true, true]], ['label' => 'Feature text goes here', 'values' => [false, false, true, true]], ['label' => 'Feature text goes here', 'values' => [false, false, 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(reset($plans) ?: []) + 1; @endphp merge(['class' => 'bg-background px-[5%] py-16 text-foreground md:py-24 lg:py-28']) }}> {{ $tagline }} {{ $heading }} {{ $description }} @foreach ($periods as $period => $label) @foreach ($plans[$period] ?? [] as $plan) {{ $plan['name'] ?? '' }} {{ $plan['price'] ?? '' }} {{ $plan['period'] ?? '' }} {{ $plan['description'] ?? '' }} {{ $plan['buttonLabel'] ?? 'Get started' }} @endforeach @foreach ($categories as $category) {{ $category['title'] ?? '' }} {{ $category['title'] ?? '' }} @foreach ($category['features'] ?? [] as $feature) {{ $feature['label'] ?? '' }} {{ $feature['label'] ?? '' }} @foreach ($feature['values'] ?? [] as $value) @if ($value === true) {{ $includedLabel }} @elseif ($value === false || $value === null) {{ $excludedLabel }} @else {{ $value }} @endif @endforeach @endforeach @endforeach @endforeach ```
{{ $tagline }}
{{ $description }}