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
BLADE
Add the classes below to each button in the group; they handle the corners and adjoining edges.
<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>
| Prop | Values |
|---|---|
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
BLADE
Build a compact toolbar from icon-only buttons (size="icon"); give each one an aria-label and a title.
<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?
| Prop | Type | Default | Description |
|---|---|---|---|
(attributes) | — | — | Takes no props; attributes such as class and aria-label are added to the container |
Slots: default (zb:button elements)
Developer notes
- The group is only a container and sets
role="group"; describe what the group is for to screen readers witharia-label.