WlButtonGroup
Visually grouped buttons (role=group).
Components / Actions v0.1.0
Appearance
size
Default
density
Default
Full example
<div class="wl-stack" data-space="md">
<WlButtonGroup aria-label="Period" >
<WlButton :variant="selected === 'day' ? 'primary' : 'secondary'" @click="selected = 'day'">
{{ "Day" }}
</WlButton>
<WlButton :variant="selected === 'week' ? 'primary' : 'secondary'" @click="selected = 'week'">
{{ "Week" }}
</WlButton>
</WlButtonGroup>
</div>Action and navigation groups
Related period buttons and an icon group with disabled endpoint pages; the application stores state.
Period: Day. Page: 1 of 5.
The group joins buttons with a shared border and sets role="group". The application stores the selected mode.
Full example
<script setup lang="ts">
import { WlButton, WlButtonGroup, WlIconButton } from "legato-ui";
import { ref } from "vue";
const period = ref("Day");
const page = ref(1);
</script>
<template>
<div class="wl-stack" data-space="lg">
<div><WlButtonGroup aria-label="Report period"><WlButton
v-for="label in ['Day', 'Week', 'Month']"
:key="label"
size="sm"
:variant="period === label ? 'primary' : 'secondary'"
:aria-pressed="period === label"
@click="period = label"
>{{ label }}</WlButton></WlButtonGroup></div>
<div><WlButtonGroup aria-label="Report pages"><WlIconButton
icon="chevron-left"
variant="secondary"
aria-label="Previous report page"
:disabled="page === 1"
@click="page--"
/><WlIconButton
icon="chevron-right"
variant="secondary"
aria-label="Next report page"
:disabled="page === 5"
@click="page++"
/></WlButtonGroup></div>
<p class="wl-text-small" role="status">
{{ "Period:" }} {{ period }}{{ ". Page:" }} {{ page }} {{ "of 5." }}
</p>
<p class="wl-text-small wl-text-muted">{{ "The group joins buttons with a shared border and sets role=\"group\". The application stores the selected mode." }}</p>
</div>
</template>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
ariaLabel | string | Not set | Group aria-label. |
size | WlSize | Not set | Size within the component family's documented scale. |
variant | WlButtonVariant | Not set | Visual treatment within this component family. |
density | WlDensity | Not set | Spacing density for this component family. |
attached | boolean | Not set | Join adjacent button borders and corners into one group. |
Events
No public events.
Slots
| Slot | Type / values | Content |
|---|---|---|
default | — | Group buttons (WlButton / WlIconButton). |
Keyboard and accessibility
- Give the group an ariaLabel describing the shared purpose of its buttons.
- Each button keeps its own name, Tab focus and handler; the group does not manage selection itself.
- If buttons switch modes, pass aria-pressed; disable navigation endpoint actions explicitly.
Keyboard and application responsibilities
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesIn your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.