WeDtClusterFilter
Single-choice filter rendered as a row of chips inside a we-dt-card-filter-container. The selected chip is tonal and bold, colored with the item color (or primary). Designed to be bound to a we-datatable filter.
Usage
vue
<template>
<we-dt-cluster-filter
v-model="filters.status"
:items="statusItems"
/>
</template>
<script setup lang="ts">
const filters = ref({
status: null,
})
const statusItems = [
{ text: 'Active', value: 'active', color: 'success' },
{ text: 'Warning', value: 'warning', color: 'warning' },
{ text: 'Closed', value: ['error', 'archived'], color: 'error' },
]
</script>Modes
- Structured filter mode (default) — the model is a filter object:
ts
{ operator: '=', value: 'active' }
{ operator: 'in', value: ['error', 'archived'] } // when the item value is an array
{ operator: '=', value: null } // "All"- Raw value mode — with
emit-raw-valuethe model is the itemvalue(nullfor "All").
Props
| Prop | Type | Default | Description |
|---|---|---|---|
items | DtFilterSelectItem[] | [] | Selectable items |
all | boolean | string | true | Prepends an "All" entry (value null). A string sets its label; false hides it |
emitRawValue | boolean | false | When true, v-model holds only the raw value |
allIcon | string | undefined | Icon of the "All" entry (shown only with show-icons) |
showIcons | boolean | false | Shows item icons as chip prepend icons |
DtFilterSelectItem:
ts
type DtFilterSelectItem = {
value: unknown
color?: string
icon?: string
} & ({ title: string } | { text: string })The label is title ?? text. The default "All" label comes from the i18n key dt.clusterFilter.all.