table-filters
40
总安装量
40
周安装量
#5254
全站排名
安装命令
npx skills add https://github.com/shipshitdev/library --skill table-filters
Agent 安装分布
claude-code
31
codex
26
opencode
26
gemini-cli
25
antigravity
24
cursor
21
Skill 文档
Table Filters
When the user is building a table that needs filters, analyze the columns and design the filtering UX.
Step 1: Analyze Each Column
For each column in the table, determine the filter type:
| Data Pattern | Filter Type | Example Columns |
|---|---|---|
| Free text, names, descriptions | Contains | Product Name, Notes, Customer |
| Fixed set of values (<20 options) | Checkboxes | Status, Category, Priority, Type |
| Numeric values | Range | Price, Quantity, Age, Score |
| Dates | Date Range | Created, Updated, Due Date |
| Boolean | Toggle | Active, Verified, Published |
Step 2: Implement the Filter Layout
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â [Filter chips go here...] [ð Filter or search...] [â] â â Unified filter field
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Sort by: [Dropdown â¾]
ââââââââââââââââ¬âââââââââââââââ¬âââââââââââââââ¬âââââââââââââââ
â Name â¼ â Status â¼ â Price â¼ â Created â¼ â â Clickable headers with filter icon
ââââââââââââââââ¼âââââââââââââââ¼âââââââââââââââ¼âââââââââââââââ¤
â ... â ... â ... â ... â
Key layout rules:
- Filter field spans table width, contains chips + search input + clear button
- Sort dropdown next to filter field (not in headers)
- Each header is clickable and opens its filter menu
- Menu appears ABOVE field when filtering (inserts chip directly)
Step 3: Build Each Filter Component
Contains Filter (text)
ââ Product Name ââââââââââââ â ââ
â âââââââââââââââââââââââââââââââ
â â Search... ââ
â âââââââââââââââââââââââââââââââ
âââââââââââââââââââââââââââââââââ
Chip result: Product Name: system
Checkbox Filter (categories)
ââ Status ââââââââââââââââ â ââ
â â Active â
â â Pending â
â â Archived â
â â Deleted â
â [Clear] [Apply] â
ââââââââââââââââââââââââââââââââ
Chip result: Status: Active, Pending or Status: Active, +2
Range Filter (numeric)
ââ Price âââââââââââââââââââ â ââ
â Min Max â
â âââââââ âââââââ â
â â 0 â - â 100 â â
â âââââââ âââââââ â
â âââââââââââââââââââââââ â â Optional slider
â [Apply] â
âââââââââââââââââââââââââââââââââ
Chip result: Price: $0 - $100
Date Range Filter
ââ Created âââââââââââââââââââ â ââ
â From To â
â ââââââââââââ ââââââââââââ â
â â 01/01/25 â - â 12/31/25 â â
â ââââââââââââ ââââââââââââ â
â [Today] [This week] [This month]â
â [Apply] â
âââââââââââââââââââââââââââââââââââ
Chip result: Created: Jan 1 - Dec 31, 2025
Chip Design Rules
- Dark background, light text, rounded pill shape
- X button on contrasting surface (clearly clickable)
- Truncate after 2 values:
Status: Active, Pending, +3 - Clicking chip reopens its filter menu
Empty State
When filters return no results:
âââââââââââââââ
â (â¯Â°â¡Â°)⯠â
â ︵ â»ââ» â
âââââââââââââââ
No results found
Try adjusting your filters
[Clear all filters]
Quick Checklist
When implementing, verify:
- Each column has appropriate filter type assigned
- Filter field contains chips (not separate row above)
- Sort is dropdown, not toggle icons in headers
- Chip shows max 2 values, then +N
- Clear all button at end of filter field
- Empty state has clear action
HTML Class Reference
Use these classes for styling compatibility with html-style:
| Element | Class | Purpose |
|---|---|---|
| Filter container | .filter-bar |
Top-level filter row |
| Chip container | .filter-chips |
Holds all active chips |
| Individual chip | .chip |
Single filter chip |
| Chip remove | .chip-remove |
X button on chip |
| Search input | .filter-search |
Text search field |
| Clear all | .filter-clear |
Clear all filters button |
| Sort control | .sort-control |
Sort dropdown container |
| Filter menu | .filter-menu |
Dropdown filter panel |
| Empty state | .empty-state |
No results container |
Data attributes:
data-columnâ Column identifier on chipsdata-filter-typeâ Filter type (contains/checkbox/range/date)
Styling Handoff
This skill outputs semantic HTML with class names. For visual styling, invoke the html-style skill after generating filter HTML.