WlFilterBar
Indicators
Full example
<script setup lang="ts">
import { WlFilterBar, WlInput, WlSelect, WlTag } from "legato-ui";
import { ref } from "vue";
const search = ref("");
const status = ref<string | null>(null);
</script>
<template>
<div class="wl-stack" data-space="md">
<WlFilterBar
:active-count="Number(Boolean(search)) + Number(Boolean(status))"
@clear="search = ''; status = null"
><template #leading><WlInput
v-model="search"
type="search"
aria-label="Search materials"
placeholder="Search"
/></template><WlSelect
v-model="status"
:options="[{ label: 'Done', value: 'done' }, { label: 'In progress', value: 'progress' }]"
option-label="label"
option-value="value"
aria-label="Status"
placeholder="All statuses"
/><template #summary><WlTag v-if="status" removable @remove="status = null">{{ status }}</WlTag></template></WlFilterBar>
</div>
</template>States
Full example
<script setup lang="ts">
import { WlFilterBar, WlInput, WlSelect, WlTag } from "legato-ui";
import { ref } from "vue";
const search = ref("");
const status = ref<string | null>(null);
</script>
<template>
<div class="wl-stack" data-space="md">
<WlFilterBar
:active-count="Number(Boolean(search)) + Number(Boolean(status))"
@clear="search = ''; status = null"
><template #leading><WlInput
v-model="search"
type="search"
aria-label="Search materials"
placeholder="Search"
/></template><WlSelect
v-model="status"
:options="[{ label: 'Done', value: 'done' }, { label: 'In progress', value: 'progress' }]"
option-label="label"
option-value="value"
aria-label="Status"
placeholder="All statuses"
/><template #summary><WlTag v-if="status" removable @remove="status = null">{{ status }}</WlTag></template></WlFilterBar>
</div>
</template>Search, filters and mobile panel
Leading, controls, actions, summary, removing active filters, clear/apply and the named open model.
Active filters: 0. Applications: 0. Settings open in a drawer on narrow screens.
Full example
<script setup lang="ts">
import { WlButton, WlFilterBar, WlInput, WlSelect, WlTag } from "legato-ui";
import { computed, ref } from "vue";
const search = ref("");
const status = ref<string | null>(null);
const open = ref(false);
const applied = ref(0);
const statuses = [{ label: "Done", value: "done" }, { label: "In progress", value: "progress" }];
const count = computed(() => Number(Boolean(search.value)) + Number(Boolean(status.value)));
function clear(): void {
search.value = "";
status.value = null;
}
</script>
<template>
<div class="wl-stack" data-space="lg">
<WlFilterBar
v-model:open="open"
class="showcase-filters"
:active-count="count"
aria-label="Material list filters"
toggle-label="Configure filters"
panel-title="Material filters"
@clear="clear"
@apply="applied++"
>
<template #leading><WlInput
v-model="search"
type="search"
aria-label="Search the material list"
placeholder="Material title"
/></template>
<WlSelect
v-model="status"
:options="statuses"
option-label="label"
option-value="value"
aria-label="Material list status"
placeholder="All statuses"
/>
<template #actions="{ clear: clearValues }">
<WlButton
size="sm"
variant="ghost"
:disabled="count === 0"
@click="clearValues"
>{{ "Reset list filters" }}</WlButton>
<WlButton size="sm" @click="applied++">{{ "Apply on desktop" }}</WlButton>
</template>
<template #summary>
<div class="wl-inline" data-space="sm">
<WlTag
v-if="search"
removable
:remove-label="'Remove search ' + search"
@remove="search = ''"
>{{ "Search:" }} {{ search }}</WlTag>
<WlTag
v-if="status"
color="blue"
removable
remove-label="Remove status filter"
@remove="status = null"
>{{ statuses.find(item => item.value === status)?.label }}</WlTag>
<span v-if="!count" class="wl-text-small wl-text-muted">{{ "No active filters" }}</span>
</div>
</template>
</WlFilterBar>
<p class="wl-text-small" role="status">
{{ "Active filters:" }} {{ count }}{{ ". Applications:" }}
{{ applied }}{{ ". Settings open in a drawer on narrow screens." }}
</p>
</div>
</template>
<style scoped>
@media (min-width: 721px) { .showcase-filters :deep(.wl-filter-bar__toolbar) { flex-wrap: wrap; } }
</style>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:open: booleanWhether the mobile filter Drawer is open.
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
activeCount | number | 0 | Number of active filters. |
ariaLabel | string | Not set | Uses locale.filters when omitted or undefined; English fallback: Filters. |
toggleLabel | string | Not set | Uses locale.filters when omitted or undefined; English fallback: Filters. |
panelTitle | string | Not set | Uses locale.filters when omitted or undefined; English fallback: Filters. |
clearLabel | string | Not set | Uses locale.reset when omitted or undefined; English fallback: Reset. |
applyLabel | string | Not set | Uses locale.apply when omitted or undefined; English fallback: Apply. |
closeLabel | string | Not set | Uses locale.closeFilters when omitted or undefined; English fallback: Close filters. |
showClear | boolean | true | — |
showApply | boolean | true | — |
disabled | boolean | false | — |
density | WlDensity | "default" | — |
pt | WlPt< | Not set | Attributes and callbacks for the component's documented pass-through sections. |
Events
| Event | Payload | When emitted |
|---|---|---|
clear | [] | Reset filter values in the application. |
apply | [] | Apply current values in the application. |
open | [] | Emitted when the surface opens. |
close | [] | Emitted when the surface closes. |
update:open | boolean | Emitted when the component requests a model change; the payload is the next value. |
Slots
| Slot | Type / values | Content |
|---|---|---|
default | default?: (props: Pick< | Filter controls; scope { open, close, clear }. |
leading | leading?: (props: {}) => unknown; | Search or another control before filters. |
actions | actions?: (props: Pick< | Desktop panel actions; scope { clear, close }. |
summary | summary?: (props: Pick< | Active filters or chips below the panel; scope { clear }. |
footer | footer?: (props: Pick< | Mobile Drawer actions; scope { apply, clear, close }. |
Pass-through: pt
Sections WlFilterBar 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 | section.wl-filter-bar | Main element of the component. |
mobileToggle | div.wl-filter-bar__mobile-toggle | Mobile filter-toggle area. |
panel | div.wl-filter-bar__panel | Inner surface containing the interactive content. |
mobileHead | div.wl-filter-bar__mobile-head | Heading area in the mobile filter panel. |
title | strong.wl-filter-bar__title | Visible component heading. |
closeButton | button | Button that closes the surface. |
toolbar | div.wl-filter-bar__toolbar | Main filter layout row. |
leading | div.wl-filter-bar__leading | Leading filter content before the controls. |
controls | div.wl-filter-bar__controls | Container for the HSV and opacity controls. |
actions | div.wl-filter-bar__actions | Area for the component actions. |
footer | div.wl-filter-bar__footer | Footer area below the main content. |
summary | div.wl-filter-bar__summary | Summary of currently active filters. |
backdrop | button.wl-filter-bar__backdrop | Backdrop that closes the mobile surface. |
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
- Set ariaLabel, toggleLabel and panelTitle to match the filters' purpose; all nested fields need their own names.
- On mobile, the closed panel is inert; opening moves focus inside, while Escape/close returns it to the trigger button.
- Clear emits an event; the application resets filter values. Apply does not make network requests itself; explain active filters in text or removable tags.
Keyboard and application responsibilities
| Key | Action |
|---|---|
| Tab / Shift+Tab | Move between controls; modal overlays retain focus inside. |
| Escape | Dismiss the top eligible overlay when dismissal is enabled. |
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:open. 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.