Option cards
Turns a radio or checkbox into a clickable card with a title, description and icon, for a few options that need explaining.
zb:option-card zubazar/ui-pro
This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →
Single choice
Give the cards in a group the same name and each its own value; mark the initial choice with checked.
<div class="grid gap-3 md:grid-cols-3">
<zb:option-card name="billing_period" value="monthly" title="Monthly" description="Renews every month" />
<zb:option-card name="billing_period" value="yearly" title="Yearly" description="Two months free" checked />
<zb:option-card name="billing_period" value="lifetime" title="Lifetime" description="One-time payment" />
</div>
| Prop | Values |
|---|---|
type | radio | checkbox |
name | Group name |
value | Submitted value |
checked | Initially selected |
With icons
icon adds an icon to the right of the title; it turns to the brand colour when the card is selected.
<div class="grid gap-3 md:grid-cols-3">
<zb:option-card name="shipping_method" value="standard" title="Standard shipping" description="Delivered in 2–4 business days" icon="truck" checked />
<zb:option-card name="shipping_method" value="express" title="Express shipping" description="At your door the next day" icon="bolt" />
<zb:option-card name="shipping_method" value="pickup" title="Store pickup" description="Collect it at your nearest branch" icon="building-storefront" />
</div>
| Prop | Values |
|---|---|
icon | zb:icon name |
Multiple choice
type="checkbox" allows several cards; in a classic form add [] to the name.
<div class="grid gap-3 md:grid-cols-2">
<zb:option-card type="checkbox" name="notifications[]" value="sms" title="SMS" description="Shipping status updates" checked />
<zb:option-card type="checkbox" name="notifications[]" value="email" title="Email" description="Monthly summary" />
</div>
| Prop | Values |
|---|---|
type | checkbox |
Disabled option
disabled dims the card and blocks the choice.
<div class="grid gap-3 md:grid-cols-2">
<zb:option-card name="payment" value="card" title="Credit card" description="Pay in full or in installments" checked />
<zb:option-card name="payment" value="cod" title="Cash on delivery" description="Not available in this region" disabled />
</div>
| Prop | Values |
|---|---|
disabled | Cannot be selected and looks dimmed |
With Livewire
Give only wire:model; the group name and the ids come from the property, and checkbox cards bind to an array.
@foreach (['standard' => 'Standard shipping', 'express' => 'Express shipping', 'pickup' => 'Store pickup'] as $value => $label)
<zb:option-card wire:model.live="shippingMethod" :value="$value" :title="$label" />
@endforeach
<zb:option-card type="checkbox" wire:model="channels" value="sms" title="SMS" />
| Prop | Values |
|---|---|
wire:model | Radio: a single value · checkbox: an array |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
title | — | — | Card title (required) |
description | — | null | Description below the title; otherwise the slot content |
type | — | radio | radio · checkbox |
name | — | null | Group name; otherwise the wire:model value |
value | — | null | Value submitted when selected |
checked | boolean | false | Initially selected |
icon | — | null | zb:icon name to the right of the title; in the brand color when the card is selected |
input-class | — | null | Classes of the inner radio or checkbox itself |
Slots: Default slot: shown as the description when description is not given.
Advanced
Rich description
Without description, the content you write inside the card becomes the description; use it for parts to highlight, such as a price.
<div class="grid gap-3 md:grid-cols-2">
<zb:option-card name="plan" value="starter" title="Starter" checked>
<strong class="text-ink">₺1,250</strong> per month, up to 5 users
</zb:option-card>
<zb:option-card name="plan" value="pro" title="Professional">
<strong class="text-ink">₺2,000</strong> per month plus priority support
</zb:option-card>
</div>
| Prop | Values |
|---|---|
description | Plain-text description |
(slot) | Content shown when there is no description |
Developer notes
class,style,x-showandwire:keygo on the card; other attributes such asdisabled,required,wire:model,aria-*anddata-*go to the inner input.- On a validation error the card gets a red border; a single checkbox card shows the message itself, while radio cards and checkbox lists show it once below the group (
zb:radio-group,zb:checkbox-group).