Checkbox or select filters
A filter UI needs to show each available value with its frequency.
TanStack · Function
Returns a Map of unique facet values to their occurrence counts. Use it to build checkbox lists, select menus, autocomplete suggestions, or other faceted controls.
This column API reads the faceted row model and returns each distinct facet value alongside its occurrence count. The required faceting factories must be registered in the table configuration; custom getUniqueValues logic can make one row contribute several values or map rendered values into facet buckets.
column.getFacetedUniqueValues(): Map<any, number>Map<any, number>
const suggestions = Array.from(
column.getFacetedUniqueValues().entries()
)
.sort((a, b) => b[1] - a[1])
.slice(0, 5000);Creates a frequency-sorted list of facet values for an autocomplete or select control.
A filter UI needs to show each available value with its frequency.
A search field should suggest values present in the faceted data.
Values should be grouped into application-defined categories for filtering.
It returns a Map whose keys are facet values and whose values are occurrence counts. The result is intended for controls such as checkboxes, select menus, and autocomplete suggestions.
Follow-up: How would you constrain a large suggestion list? Convert the Map entries to an array, sort or rank them, and take only the needed leading values.
The API depends on faceting configuration. For client-side faceting, the table needs the faceted row model and the factory that computes unique values and counts.
Follow-up: What if faceting is server-side? Supply a getFacetedUniqueValues table option that resolves and returns the server-provided Map.
For scalar columns, each row normally contributes one value, so a count also corresponds to a row count. With getUniqueValues, a row can contribute multiple values, and counts then describe occurrences.
Follow-up: How can a custom facet bucket differ from the displayed value? Return a bucket key from getUniqueValues while retaining the accessor value for rendering and other table behavior.
createFacetedRowModelcreateFacetedUniqueValuesgetUniqueValuesgetFacetedRowModel