Comparison
Comparison sections — a two-column us-vs-them layout contrasting your product with the alternative, and feature-comparison tables across your own plans or against competitors.
Preview
@props([
'heading' => 'Compare plans',
'subheading' => 'Pick the plan that fits your team. Switch or cancel anytime.',
'plans' => null,
'features' => null,
])
@php
$plans ??= [
['name' => 'Starter', 'price' => '$0', 'period' => '/mo', 'cta' => 'Get started', 'featured' => false],
['name' => 'Pro', 'price' => '$29', 'period' => '/mo', 'cta' => 'Start free trial', 'featured' => true],
['name' => 'Team', 'price' => '$99', 'period' => '/mo', 'cta' => 'Contact sales', 'featured' => false],
];
// Each feature row: a label, plus a boolean per plan column (same order as $plans).
$features ??= [
['label' => 'Projects', 'values' => [true, true, true]],
['label' => 'Unlimited collaborators', 'values' => [false, true, true]],
['label' => 'All components & blocks', 'values' => [false, true, true]],
['label' => 'Pro blocks', 'values' => [false, true, true]],
['label' => 'Priority support', 'values' => [false, true, true]],
['label' => 'SSO & roles', 'values' => [false, false, true]],
['label' => 'Audit logs', 'values' => [false, false, true]],
['label' => 'Dedicated success manager', 'values' => [false, false, true]],
];
@endphp
<x-ui.section space="xl" {{ $attributes }}>
<div class="mx-auto max-w-5xl px-4">
<div class="mx-auto max-w-2xl text-center">
<h2 class="text-3xl font-bold tracking-tight sm:text-4xl">{{ __($heading) }}</h2>
<p class="mt-4 text-base text-muted-foreground">{{ __($subheading) }}</p>
</div>
<div class="mt-12 overflow-x-auto rounded-lg border border-border shadow-sm">
<x-ui.table class="min-w-[40rem] border-separate border-spacing-0">
<x-ui.table.header>
<x-ui.table.row class="hover:bg-transparent">
<x-ui.table.head class="w-1/3 align-bottom">
<span class="sr-only">{{ __('Feature') }}</span>
</x-ui.table.head>
@foreach ($plans as $plan)
<x-ui.table.head @class([
'w-1/5 align-bottom text-center',
'rounded-t-lg bg-primary/5' => $plan['featured'] ?? false,
])>
<div class="flex flex-col items-center gap-4 py-6">
@if ($plan['featured'] ?? false)
<x-ui.badge>{{ __('Recommended') }}</x-ui.badge>
@endif
<span class="text-base font-semibold text-foreground">{{ __($plan['name']) }}</span>
<div class="flex items-baseline gap-0.5">
<span class="text-2xl font-bold tracking-tight text-foreground">{{ $plan['price'] }}</span>
<span class="text-base font-medium text-muted-foreground">{{ $plan['period'] ?? '' }}</span>
</div>
<x-ui.button
size="sm"
:variant="($plan['featured'] ?? false) ? 'default' : 'outline'"
class="w-full"
>
{{ __($plan['cta']) }}
</x-ui.button>
</div>
</x-ui.table.head>
@endforeach
</x-ui.table.row>
</x-ui.table.header>
<x-ui.table.body>
@foreach ($features as $feature)
<x-ui.table.row class="hover:bg-transparent">
<x-ui.table.cell class="font-medium text-foreground">
{{ __($feature['label']) }}
</x-ui.table.cell>
@foreach ($plans as $i => $plan)
<x-ui.table.cell @class([
'text-center',
'bg-primary/5' => $plan['featured'] ?? false,
'rounded-b-lg' => ($plan['featured'] ?? false) && $loop->parent->last,
])>
@if ($feature['values'][$i] ?? false)
<svg class="mx-auto size-5 text-primary" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.7 5.3a1 1 0 010 1.4l-7.5 7.5a1 1 0 01-1.4 0L3.3 9.7a1 1 0 011.4-1.4l3.3 3.29 6.8-6.8a1 1 0 011.4 0z" clip-rule="evenodd" />
</svg>
<span class="sr-only">{{ __('Included') }}</span>
@else
<svg class="mx-auto size-5 text-muted-foreground" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
<path d="M5 10h10" />
</svg>
<span class="sr-only">{{ __('Not included') }}</span>
@endif
</x-ui.table.cell>
@endforeach
</x-ui.table.row>
@endforeach
</x-ui.table.body>
</x-ui.table>
</div>
</div>
</x-ui.section>
Installation
php artisan ui:add blocks/comparison-plans-table
Registry contract
Install confidence
php artisan ui:add blocks/comparison-plans-table
writes only the generated targets below. The CLI validates each file hash before writing and
prompts before replacing local changes unless --force is used.
- Version
- 1.0.4
- License
- open
- Stability
- stable
- Contract
- v1
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/blocks/comparison-plans-table.blade.php |
Registry dependencies
Package dependencies
composer: jml/brok:^0.2
Use with AI
A brief for your coding agent: what the block is, the install command, how to render it, its props and the rules. Copy it, or open a prompt about this block in an assistant.
# Brok UI block: Pricing Table (`comparison-plans-table`)
A feature-comparison pricing table with three plan columns, per-feature check/dash cells, a subtly highlighted recommended column, and horizontal scroll on mobile.
Brok UI is a Laravel Blade registry. `ui:add` copies this block into the app as plain Blade the app owns; it composes installed `<brok:*>` primitives and semantic design tokens.
## Install
```bash
php artisan ui:add blocks/comparison-plans-table
```
## Render it
```blade
<x-blocks.comparison-plans-table />
```
## Props
- `heading` (string, default `Compare plans`) — Section headline.
- `subheading` (string, default `Pick the plan that fits your team. Switch or cancel anytime.`) — Supporting copy under the heading.
- `plans` (mixed|null, default `null`) — Array of plan columns ({name, price, period, cta, featured}); null falls back to sample plans.
- `features` (mixed|null, default `null`) — Array of comparison rows ({label, values: [bool per plan, same order as plans]}); null falls back to sample rows.
## Use when
- Comparing three plans feature-by-feature in a table with check/dash cells per row.
- Needing a subtly highlighted recommended column and horizontal scroll on mobile instead of separate plan cards.
## Avoid when
- Presenting plans as standalone cards rather than a row-by-row table; use pricing-cards instead.
## Rules
- Render the installed block with `<x-blocks.comparison-plans-table />` and pass data through its props; edit the copied file only for structural changes.
- Keep the semantic design tokens (`bg-background`, `text-muted-foreground`); never swap in raw colour utilities.
- Keep the `data-slot` attributes and the logical (start/end) spacing so the markup still mirrors under `dir="rtl"`.
## Links
- Docs: https://brokui.dev/blocks/comparison-plans-table
- Registry JSON (files, props, contract): https://brokui.dev/r/open/blocks/comparison-plans-table.json
Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.
Guidance
Use when
- Comparing three plans feature-by-feature in a table with check/dash cells per row.
- Needing a subtly highlighted recommended column and horizontal scroll on mobile instead of separate plan cards.
Avoid when
- Presenting plans as standalone cards rather than a row-by-row table; use pricing-cards instead.
Anti-patterns
- Do not replace semantic props with conflicting utility classes.
- Do not remove labels, focus styles, or state attributes.
- Anatomy
Usage
Render the block as a component, passing data where useful:
<x-blocks.comparison-plans-table />
Built from primitives
This block composes installed <brok:*> primitives and semantic design
tokens only — it does not reimplement any primitive. Re-theme it (light, dark, admin, customer) by
editing CSS variables; flip the preview to RTL to confirm it mirrors.
Source
The exact, editable file ui:add writes
into your app. The preview above renders this same source — there are no preview-only blocks.
@props([
'heading' => 'Compare plans',
'subheading' => 'Pick the plan that fits your team. Switch or cancel anytime.',
'plans' => null,
'features' => null,
])
@php
$plans ??= [
['name' => 'Starter', 'price' => '$0', 'period' => '/mo', 'cta' => 'Get started', 'featured' => false],
['name' => 'Pro', 'price' => '$29', 'period' => '/mo', 'cta' => 'Start free trial', 'featured' => true],
['name' => 'Team', 'price' => '$99', 'period' => '/mo', 'cta' => 'Contact sales', 'featured' => false],
];
// Each feature row: a label, plus a boolean per plan column (same order as $plans).
$features ??= [
['label' => 'Projects', 'values' => [true, true, true]],
['label' => 'Unlimited collaborators', 'values' => [false, true, true]],
['label' => 'All components & blocks', 'values' => [false, true, true]],
['label' => 'Pro blocks', 'values' => [false, true, true]],
['label' => 'Priority support', 'values' => [false, true, true]],
['label' => 'SSO & roles', 'values' => [false, false, true]],
['label' => 'Audit logs', 'values' => [false, false, true]],
['label' => 'Dedicated success manager', 'values' => [false, false, true]],
];
@endphp
<x-ui.section space="xl" {{ $attributes }}>
<div class="mx-auto max-w-5xl px-4">
<div class="mx-auto max-w-2xl text-center">
<h2 class="text-3xl font-bold tracking-tight sm:text-4xl">{{ __($heading) }}</h2>
<p class="mt-4 text-base text-muted-foreground">{{ __($subheading) }}</p>
</div>
<div class="mt-12 overflow-x-auto rounded-lg border border-border shadow-sm">
<x-ui.table class="min-w-[40rem] border-separate border-spacing-0">
<x-ui.table.header>
<x-ui.table.row class="hover:bg-transparent">
<x-ui.table.head class="w-1/3 align-bottom">
<span class="sr-only">{{ __('Feature') }}</span>
</x-ui.table.head>
@foreach ($plans as $plan)
<x-ui.table.head @class([
'w-1/5 align-bottom text-center',
'rounded-t-lg bg-primary/5' => $plan['featured'] ?? false,
])>
<div class="flex flex-col items-center gap-4 py-6">
@if ($plan['featured'] ?? false)
<x-ui.badge>{{ __('Recommended') }}</x-ui.badge>
@endif
<span class="text-base font-semibold text-foreground">{{ __($plan['name']) }}</span>
<div class="flex items-baseline gap-0.5">
<span class="text-2xl font-bold tracking-tight text-foreground">{{ $plan['price'] }}</span>
<span class="text-base font-medium text-muted-foreground">{{ $plan['period'] ?? '' }}</span>
</div>
<x-ui.button
size="sm"
:variant="($plan['featured'] ?? false) ? 'default' : 'outline'"
class="w-full"
>
{{ __($plan['cta']) }}
</x-ui.button>
</div>
</x-ui.table.head>
@endforeach
</x-ui.table.row>
</x-ui.table.header>
<x-ui.table.body>
@foreach ($features as $feature)
<x-ui.table.row class="hover:bg-transparent">
<x-ui.table.cell class="font-medium text-foreground">
{{ __($feature['label']) }}
</x-ui.table.cell>
@foreach ($plans as $i => $plan)
<x-ui.table.cell @class([
'text-center',
'bg-primary/5' => $plan['featured'] ?? false,
'rounded-b-lg' => ($plan['featured'] ?? false) && $loop->parent->last,
])>
@if ($feature['values'][$i] ?? false)
<svg class="mx-auto size-5 text-primary" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M16.7 5.3a1 1 0 010 1.4l-7.5 7.5a1 1 0 01-1.4 0L3.3 9.7a1 1 0 011.4-1.4l3.3 3.29 6.8-6.8a1 1 0 011.4 0z" clip-rule="evenodd" />
</svg>
<span class="sr-only">{{ __('Included') }}</span>
@else
<svg class="mx-auto size-5 text-muted-foreground" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
<path d="M5 10h10" />
</svg>
<span class="sr-only">{{ __('Not included') }}</span>
@endif
</x-ui.table.cell>
@endforeach
</x-ui.table.row>
@endforeach
</x-ui.table.body>
</x-ui.table>
</div>
</div>
</x-ui.section>
Ownership & lifecycle
Owner, release state, review evidence and adoption for this item.
- Owner
- Platform UI (@JoshJML)
- Current version
-
1.0.4 - Status
- Stable
- License
-
open - Deprecation
- Not deprecated
- Contract
-
v1 - Foundation
-
≥ 1.0.0