v0.0.2
Demos (demo panel, opens in a new tab)

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

PRO

This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →

Delivery method

Delivery method: view
BLADE

Several cards with the same name make a group; checked sets the card chosen first.

blade
<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: view
BLADE

With Livewire, give wire:model instead of name; the card that matches the property's value is checked.

blade
<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

Own description and a disabled option: view
BLADE

For a formatted description, write into the slot instead of description; disabled fades the card and makes it unselectable.

blade
<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?

PropTypeDefaultDescription
title— — The card's title; required
description—nullA short description under the title
name—nullThe group's name; the wire:model property's name when left out
value—nullThe value sent when the card is chosen
checkedbooleanfalseStarts chosen
icon—nullA 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

Events, hooks and details
  • The chosen card gets a frame in the brand colour.
  • To introduce the group to screen readers, give the container role="radiogroup" and an aria-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, disabled and required go on the radio button inside the card.
Zubazar UI · ZubazarDesigned for people.