Data Table Toolbar
A composable toolbar with search, faceted filters, column visibility toggle, and view mode switcher for DataTable.
Basic
A composable toolbar with search, faceted filters, column visibility toggle, and view mode switcher for DataTable.
Installation
Install the component via the CLI in one command.
npx @work-rjkashyap/unified-ui add data-table-toolbarpnpm dlx @work-rjkashyap/unified-ui add data-table-toolbarnpx @work-rjkashyap/unified-ui add data-table-toolbarbunx @work-rjkashyap/unified-ui add data-table-toolbarIf you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.
Or install the full package
Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.
npm install @work-rjkashyap/unified-uipnpm add @work-rjkashyap/unified-uiyarn add @work-rjkashyap/unified-uibun add @work-rjkashyap/unified-uiAnatomy
import { DataTableToolbar } from "@work-rjkashyap/unified-ui";Examples
Search Only
With Faceted Filters
Column Visibility
View Mode Switcher
Full Featured
Props
| Prop | Type | Default | Description |
|---|---|---|---|
searchValue | string | "" | Current search value. |
onSearchChange | (value: string) => void | — | Search change callback. |
searchPlaceholder | string | "Search..." | Placeholder text. |
searchDebounce | number | 300 | Debounce delay in ms. |
filters | DataTableFilter[] | — | Filter definitions. |
onFilterChange | (id: string, selected: string[]) => void | — | Filter change callback. |
onClearFilters | () => void | — | Clear all filters callback. |
columns | ColumnVisibility[] | — | Column visibility state. |
onColumnVisibilityChange | (id: string, visible: boolean) => void | — | Column visibility change callback. |
viewMode | "table" | "grid" | "list" | — | Current view mode. |
viewModes | ViewMode[] | — | Available view modes. |
onViewModeChange | (mode: ViewMode) => void | — | View mode change callback. |
actions | ReactNode | — | Extra action buttons on the right. |
className | string | — | Additional CSS classes. |
DataTableFilter
| Property | Type | Description |
|---|---|---|
id | string | Unique filter identifier. |
label | string | Display label. |
options | Array<{ label, value, count? }> | Available filter options. |
selected | string[] | Currently selected values. |
ColumnVisibility
| Property | Type | Description |
|---|---|---|
id | string | Column identifier. |
label | string | Display label. |
visible | boolean | Whether column is visible. |
Accessibility
- Search input has
aria-labelfor screen readers. - Filter and column dropdowns are fully keyboard navigable.
- Clear button removes all active filters at once.
- View mode buttons use
aria-pressedto indicate active state. - All interactive elements have visible focus rings.
For best results, pair DataTableToolbar with DataTable so that filter
and column visibility state is shared between the toolbar and the table
body.
Design Tokens
| Token | Usage |
|---|---|
--background | Input and dropdown background |
--foreground | Text color |
--muted-foreground | Placeholder text, counts |
--border | Input and dropdown borders |
--primary | Active filter badge, checkbox |
--muted | Hover backgrounds |
--radius-md | Input and button radius |
--duration-fast | Transition speed |