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

Button group

Shows related buttons, such as a period selector or a toolbar, as an attached, single-piece group.

zb:button-group zubazar/ui · free (MIT)

Basic usage

Basic usage: view
BLADE

Add the classes below to each button in the group; they handle the corners and adjoining edges.

blade
<zb:button-group aria-label="Period">
    <zb:button variant="white" class="!rounded-none first:!rounded-l last:!rounded-r -ml-px first:ml-0 relative hover:z-10 focus-visible:z-10">Day</zb:button>
    <zb:button variant="white" class="!rounded-none first:!rounded-l last:!rounded-r -ml-px first:ml-0 relative hover:z-10 focus-visible:z-10">Week</zb:button>
    <zb:button variant="white" class="!rounded-none first:!rounded-l last:!rounded-r -ml-px first:ml-0 relative hover:z-10 focus-visible:z-10">Month</zb:button>
</zb:button-group>
PropValues
class value of the buttons!rounded-none first:!rounded-l last:!rounded-r -ml-px first:ml-0 relative hover:z-10 focus-visible:z-10

Icon toolbar

Icon toolbar: view
BLADE

Build a compact toolbar from icon-only buttons (size="icon"); give each one an aria-label and a title.

blade
<zb:button-group aria-label="Record actions">
    <zb:button variant="white" size="icon" aria-label="Edit" title="Edit" class="!rounded-none first:!rounded-l last:!rounded-r -ml-px first:ml-0 relative hover:z-10 focus-visible:z-10">
        <zb:icon name="pencil-square" size="4" />
    </zb:button>
    <zb:button variant="white" size="icon" aria-label="Copy" title="Copy" class="!rounded-none first:!rounded-l last:!rounded-r -ml-px first:ml-0 relative hover:z-10 focus-visible:z-10">
        <zb:icon name="document-duplicate" size="4" />
    </zb:button>
    <zb:button variant="white" size="icon" aria-label="Delete" title="Delete" class="!rounded-none first:!rounded-l last:!rounded-r -ml-px first:ml-0 relative hover:z-10 focus-visible:z-10">
        <zb:icon name="trash" size="4" />
    </zb:button>
</zb:button-group>

Props

The values the component takes. What are props and slots?

PropTypeDefaultDescription
(attributes)— — Takes no props; attributes such as class and aria-label are added to the container

Slots: default (zb:button elements)

Developer notes

Events, hooks and details
  • The group is only a container and sets role="group"; describe what the group is for to screen readers with aria-label.
Zubazar UI · ZubazarDesigned for people.