DataTable Filter Menu
niko-table/data-table-filter-menuFreeComponent
Command palette-style filter interface for adding and managing column filters.
Install it
npx shadcn@latest add https://niko-table.com/r/data-table-filter-menu.jsonSource
1"use client"23/**4 * niko-table — created by Semir N. (Semkoo, https://github.com/Semkoo) with AI assistance.5 *6 * Before reporting anything: please check the changelog first.7 * - In-repo: ./CHANGELOG.md8 * - Docs site: https://niko-table.com/changelog9 *10 * Found a bug or have a fix? Open an issue or PR on GitHub so other11 * users (and future LLMs reading this code) benefit:12 * https://github.com/Semkoo/niko-table-registry13 */14import React from "react"15import { useDataTable } from "../core/data-table-context"16import { TableFilterMenu } from "../filters/table-filter-menu"17import { FILTER_VARIANTS } from "../lib/constants"18import type { Option } from "../types"1920type BaseTableFilterMenuProps<TData> = Omit<21 React.ComponentProps<typeof TableFilterMenu<TData>>,22 "table"23>2425interface AutoOptionProps {26 /**27 * Automatically generate select/multiSelect options for columns lacking static options28 * @default true29 */30 autoOptions?: boolean31 /** Show counts beside each option (computed from rows) */32 showCounts?: boolean33 /** Recompute counts based on currently filtered rows */34 dynamicCounts?: boolean35 /**36 * If true, only generate options from filtered rows. If false, generate from all rows.37 * This controls which rows are used to generate the option list itself.38 * Note: This is separate from dynamicCounts which controls count calculation.39 * @default true40 */41 limitToFilteredRows?: boolean42 /** Only generate options for these column ids */43 includeColumns?: string[]44 /** Exclude these column ids from generation */45 excludeColumns?: string[]46 /** Limit number of generated options per column */47 limitPerColumn?: number48 /**49 * Merge strategy when static options already exist:50 * - "preserve" keeps user options untouched (default)51 * - "augment" adds counts to matching values52 * - "replace" overrides with generated options53 */54 mergeStrategy?: "preserve" | "augment" | "replace"55}5657type DataTableFilterMenuProps<TData> = BaseTableFilterMenuProps<TData> &58 AutoOptionProps5960/**61 * A filter menu component that automatically connects to the DataTable context.62 * Filters are managed directly by the table state - no internal state needed.63 *64 * @example - Basic usage65 * <DataTableFilterMenu />66 *67 * @example - Custom alignment and positioning68 * <DataTableFilterMenu align="end" side="bottom" />69 *70 * @example - Custom styling71 * <DataTableFilterMenu className="w-[400px]" />72 */73// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from niko-table
All 31 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| DataTable Asidedata-table-aside | niko-table | Components | Free | 1 dep | |
| DataTable Clear Filterdata-table-clear-filter | niko-table | Components | Free | 1 dep · 2 files | |
| DataTable Column Auto-fitdata-table-column-auto-fit | niko-table | Components | Free | no deps · 2 files | |
| DataTable Column Date Filterdata-table-column-date-filter | niko-table | Components | Free | 2 deps · 2 files | |
| DataTable Column DnDdata-table-column-dnd | niko-table | Components | Free | 4 deps · 3 files | |
| DataTable Column Faceted Filterdata-table-column-faceted-filter | niko-table | Components | Free | 1 dep · 3 files | |
| DataTable Column Hidedata-table-column-hide | niko-table | Components | Free | 1 dep · 2 files | |
| DataTable Column Pindata-table-column-pin | niko-table | Components | Free | 1 dep · 2 files |
