Option card
A radio button drawn as a card, with a title, a description and an icon; the checkout asks for the delivery and payment methods with it.
zb:shop.option zubazar/ui-pro
This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →
Delivery method
Several cards with the same name make a group; checked sets the card chosen first.
<div class="grid gap-3 sm:grid-cols-2" role="radiogroup" aria-label="Delivery method">
<zb:shop.option name="delivery" value="standard" title="Standard delivery · ₺79.90" description="2–4 business days" icon="truck" checked />
<zb:shop.option name="delivery" value="express" title="Express delivery · ₺149.90" description="At your door the next day" icon="bolt" />
</div>
With Livewire
With Livewire, give wire:model instead of name; the card that matches the property's value is checked.
<div class="grid gap-3 sm:grid-cols-3" role="radiogroup" aria-label="Payment method">
<zb:shop.option wire:model.live="payment" value="card" title="Credit card" description="In full or in instalments" icon="credit-card" />
<zb:shop.option wire:model.live="payment" value="transfer" title="Bank transfer" description="Pay with the order number" icon="building-library" />
<zb:shop.option wire:model.live="payment" value="cash" title="Pay on delivery" description="Cash or card at the door" icon="banknotes" />
</div>
Own description and a disabled option
For a formatted description, write into the slot instead of description; disabled fades the card and makes it unselectable.
<div class="grid gap-3" role="radiogroup" aria-label="Delivery method">
<zb:shop.option name="shipping" value="pickup" title="Pick up in store" icon="building-storefront" checked>
Kadıköy store, today after 6 pm · <strong class="font-medium text-ink">Free</strong>
</zb:shop.option>
<zb:shop.option name="shipping" value="same-day" title="Same-day delivery" description="Not available for this address" icon="clock" disabled />
</div>
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
title | — | — | The card's title; required |
description | — | null | A short description under the title |
name | — | null | The group's name; the wire:model property's name when left out |
value | — | null | The value sent when the card is chosen |
checked | boolean | false | Starts chosen |
icon | — | null | A zb:icon name to the right of the title; takes the brand colour when the card is chosen |
Slots: Default slot: shown in place of the description when description is not given.
Developer notes
- The chosen card gets a frame in the brand colour.
- To introduce the group to screen readers, give the container
role="radiogroup"and anaria-label. - With only
wire:model, the group's name and the card's id come from the bound property (payment,payment-card). - Attributes such as
wire:model,disabledandrequiredgo on the radio button inside the card.