Skip to content

Chip and Badge Toggle Filter

Use Chip and Badge Toggles when a column has a small, recognizable status set that is faster to scan as colored pills than as a long checklist.

Source code
TypeScriptts
grid.plugins = [AdvanceFilterPlugin];
grid.columns = [
  {
    prop: 'status',
    name: 'Status',
    filter: ['string', FILTER_CHIP_BADGE_TOGGLES],
  },
];
grid.filter = true;

return [
  { status: 'Open' },
  { status: 'Pending' },
  { status: 'Closed' },
  { status: 'Open' },
  { status: 'Pending' },
  { status: 'Closed' },
];
import {
AdvanceFilterPlugin,
FILTER_CHIP_BADGE_TOGGLES,
} from '@revolist/revogrid-pro';
import '@revolist/revogrid-pro/dist/revogrid-pro.css';
grid.plugins = [AdvanceFilterPlugin];
grid.columns = [
{
prop: 'status',
name: 'Status',
filter: ['string', FILTER_CHIP_BADGE_TOGGLES],
},
];
grid.filter = true;

The built-in derives its choices from parsed unique values. It supports finite numbers, booleans, and strings while keeping their types distinct. When the column uses ColumnDropdown object options, badge labels automatically reuse the matching option label while saved filter values remain the original typed IDs. A configured badge result takes precedence over the dropdown label.

Body IDSaved operatorValue shape
chipBadgeToggleschipBadgeSelection{ values: (string | number | boolean)[], includeBlanks: boolean }

includeBlanks uses the grid’s configured blank semantics. Selecting every available value and including blanks removes the no-op condition.

grid.filter = {
multiFilterItems: {
status: [
{
id: 1,
type: 'chipBadgeSelection',
value: {
values: ['Open', 'Blocked'],
includeBlanks: false,
},
relation: 'and',
},
],
},
};

Replace the built-in registration with a configured version. The stable type and operator IDs do not change:

import {
FILTER_CHIP_BADGE_TOGGLES,
createChipBadgeStructuredFilterType,
defineAdvancedFilterConfig,
} from '@revolist/revogrid-pro';
const statusBadges = createChipBadgeStructuredFilterType({
order: ['Blocked', 'Open', 'Done'],
maxVisibleBadges: 20,
badge: ({ value }) => ({
label: String(value),
color: value === 'Blocked' ? '#ef4444' : '#22c55e',
}),
});
grid.filter = defineAdvancedFilterConfig({
structuredFilterTypes: [statusBadges],
});
grid.columns = [
{ prop: 'status', filter: ['string', FILTER_CHIP_BADGE_TOGGLES] },
];

badge may return a plain label or safe { label, className, color } metadata. Labels render as text, not HTML. The default visible limit is 200 pills; the complete value set still controls matching when the mounted UI is limited.

  • Do not use presentation labels as saved values. Filtering uses the original typed scalar value.
  • Do not pass null, undefined, or '' in values; represent blanks with includeBlanks.
  • Do not create hundreds of status chips without setting a useful maxVisibleBadges; use the Faceted List filter for high-cardinality values.
  • Do not replace the registration with a different ID. Keep FILTER_CHIP_BADGE_TOGGLES so column configuration and saved state remain compatible.