WlChip
Indicators
Full example
<script setup lang="ts">
import { WlButton, WlChip } from "legato-ui";
import { ref } from "vue";
const active = ref(false);
const visible = ref(true);
</script>
<template>
<div class="wl-stack" data-space="md">
<WlChip
v-if="visible"
v-model:active="active"
:count="5"
removable
size="sm"
remove-label="Remove Design tag"
@remove="visible = false"
>{{ "Design" }}</WlChip>
<WlButton v-else size="sm" @click="visible = true">{{ "Restore tag" }}</WlButton>
</div>
</template>Size and density
Full example
<script setup lang="ts">
import { WlButton, WlChip } from "legato-ui";
import { ref } from "vue";
const active = ref(false);
const visible = ref(true);
</script>
<template>
<div class="wl-stack" data-space="md">
<WlChip
v-if="visible"
v-model:active="active"
:count="5"
removable
size="sm"
remove-label="Remove Design tag"
@remove="visible = false"
>{{ "Design" }}</WlChip>
<WlButton v-else size="sm" @click="visible = true">{{ "Restore tag" }}</WlButton>
</div>
</template>Independent filters
Active, count including zero, disabled, named models and clearing all filters.
Filters: Design.
Full example
<script setup lang="ts">
import { WlButton, WlChip } from "legato-ui";
import { computed, ref } from "vue";
const design = ref(true);
const development = ref(false);
const review = ref(false);
const selected = computed(() => [[design.value, "Design"], [development.value, "Development"], [review.value, "Review"]].filter(([active]) => active).map(([, label]) => label).join(", "));
</script>
<template>
<div class="wl-stack" data-space="lg">
<div class="wl-inline" data-space="sm">
<WlChip v-model:active="design" :count="7">{{ "Design" }}</WlChip>
<WlChip v-model:active="development" :count="23">{{ "Development" }}</WlChip>
<WlChip v-model:active="review" :count="0">{{ "Review" }}</WlChip>
<WlChip disabled>{{ "Archive" }}</WlChip>
</div>
<div>
<WlButton size="sm" variant="ghost" @click="design = false; development = false; review = false">
{{ "Clear all filters" }}
</WlButton>
</div>
<p class="wl-text-small" role="status">{{ "Filters:" }} {{ selected || "none selected" }}.</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.
v-model:active: boolean
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
active | boolean | false | Whether the chip is selected. |
count | number | Not set | Trailing count. |
disabled | boolean | false | Disables the chip. |
removable | boolean | false | Show a removal action for this chip. |
removeLabel | string | Not set | Accessible name of the removal action. |
size | WlSizeSm | "md" | Size within the component family's documented scale. |
density | WlDensity | "default" | Spacing density for this component family. |
pt | WlPt< | Not set | Attributes and callbacks for the component's documented pass-through sections. |
Events
| Event | Payload | When emitted |
|---|---|---|
click | [event: MouseEvent] | Click (not emitted when disabled). |
update:active | boolean | New active value after toggling; for v-model:active. |
remove | [event: MouseEvent] | Emitted when the removal action is activated. |
Slots
| Slot | Type / values | Content |
|---|---|---|
default | default?(props: Record< | Chip text. |
count | count?(props: { count: number }): unknown; | Custom chip count; receives the numeric count. |
removeIcon | removeIcon?(props: Record< | Custom graphic inside the named removal action. |
Pass-through: pt
Sections WlChip are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
root | button / a.wl-chip | Main element of the component. |
action | button / a.wl-chip__action | Action area within the component. |
label | span.wl-chip__label | Visible component label. |
count | span.wl-chip__count | Supplementary count inside a chip. |
removeButton | button.wl-chip__remove | Button that removes the associated value or file. |
removeIcon | span | Decorative remove icon. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- Chip is a native toggle button; active is reflected in aria-pressed.
- V-model:active updates an independent boolean state; the application decides whether multiple chips can be selected.
- Slot text should explain the filter. Count adds context; disabled blocks the action and Tab focus.
Keyboard and application responsibilities
| Key | Action |
|---|---|
| Tab / Shift+Tab | Move between enabled links, actions and form controls. |
| Enter / Space | Activate native actions; links follow with Enter. |
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 PracticesChanges are emitted through v-model:active. After selection, cancellation and reset, labels and states must remain clear.
In your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.