Skip to content

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 ​

  1. 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"
  1. Raw value mode — with emit-raw-value the model is the item value (null for "All").

Props ​

PropTypeDefaultDescription
itemsDtFilterSelectItem[][]Selectable items
allboolean | stringtruePrepends an "All" entry (value null). A string sets its label; false hides it
emitRawValuebooleanfalseWhen true, v-model holds only the raw value
allIconstringundefinedIcon of the "All" entry (shown only with show-icons)
showIconsbooleanfalseShows 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.

Source Code ​