Pill action
A button with a colored round badge and a label that shows a few quick actions side by side, at equal width, on mobile.
zb:pill-action zubazar/ui-pro
This component is in Zubazar UI Pro; Zubazar UI Pro brings Zubazar UI with it. Installing Zubazar UI Pro →
Basic usage
The badge content (an icon or a single character) comes from the slot, and the text below it from label.
<div class="flex flex-wrap">
<zb:pill-action label="Approve" variant="success"><zb:icon name="check" size="3.5" /></zb:pill-action>
<zb:pill-action label="Hold" variant="warning"><zb:icon name="exclamation-triangle" size="3.5" /></zb:pill-action>
<zb:pill-action label="Address"><zb:icon name="map-pin" size="3.5" /></zb:pill-action>
<zb:pill-action label="Cancel" variant="danger"><zb:icon name="x-mark" size="3.5" /></zb:pill-action>
</div>
| Prop | Values |
|---|---|
label | Text of the button |
Colors
Choose the badge color with variant (default info); match it to its meaning: success for positive, warning for a warning, danger for a rejection.
<div class="flex flex-wrap">
<zb:pill-action label="Success" variant="success">1</zb:pill-action>
<zb:pill-action label="Warning" variant="warning">2</zb:pill-action>
<zb:pill-action label="Danger" variant="danger">3</zb:pill-action>
<zb:pill-action label="Info">4</zb:pill-action>
<zb:pill-action label="Primary" variant="primary">5</zb:pill-action>
</div>
| Prop | Values |
|---|---|
variant | primary | secondary | success | danger | warning | info | dark |
Emphasized and disabled
emphasized highlights the recommended action with a solid green badge, and disabled makes the button faded and unclickable.
<div class="flex flex-wrap">
<zb:pill-action label="Approve" emphasized><zb:icon name="check" size="3.5" /></zb:pill-action>
<zb:pill-action label="Hold" variant="warning"><zb:icon name="exclamation-triangle" size="3.5" /></zb:pill-action>
<zb:pill-action label="Address" disabled><zb:icon name="map-pin" size="3.5" /></zb:pill-action>
</div>
| Prop | Values |
|---|---|
emphasized | true | false |
disabled | true | false |
With Livewire
By default the button renders type="button"; attributes such as wire:click go straight to the button.
<div class="flex flex-wrap">
<zb:pill-action label="Approve" emphasized wire:click="approve({{ $order->id }})">
<zb:icon name="check" size="3.5" />
</zb:pill-action>
<zb:pill-action label="Hold" variant="warning" wire:click="hold({{ $order->id }})">
<zb:icon name="exclamation-triangle" size="3.5" />
</zb:pill-action>
</div>
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
label | — | null | Text of the button |
variant | — | info | primary · secondary · success · danger · warning · info · dark (emerald, amber, red, blue also work) |
emphasized | boolean | false | Solid green badge and dark text (independent of variant) |
disabled | boolean | false | Faded and unclickable |
Slots: default (content of the badge: an icon or a single character)
Developer notes
- The buttons grow to share their row equally; place them side by side inside a
flexcontainer.