Filter
Overviewimport { FilterBar, FilterChip, FilterList } from '@nili/ui';This is the library’s own overview page, rendered live. Switch the language or the theme in the header and it follows.
Horizontal Filters
A row of filter chips. Active chips show the chosen value and an optional clear button. Use placeholder for the dashed “Add filter” affordance.
import { FilterBar, FilterChip, Icon } from "@nili/ui"
import { RiPriceTag3Line, RiCalendarLine, RiUserLine } from "@remixicon/react"
export function Example() {
return (
<FilterBar surface="panel" label="Table filters">
<FilterChip
active
value="Active"
startIcon={<Icon icon={RiPriceTag3Line} />}
onClear={() => {}}
clearLabel="Clear"
>
Status
</FilterChip>
<FilterChip startIcon={<Icon icon={RiCalendarLine} />}>Date</FilterChip>
<FilterChip startIcon={<Icon icon={RiUserLine} />}>Owner</FilterChip>
<FilterChip placeholder>Add filter</FilterChip>
</FilterBar>
)
}Vertical Filters
Figma's Vertical Filter Items — a sidebar column with counts and an active state.
import { FilterList, FilterListItem } from "@nili/ui"
export function Example() {
return (
<div className="w-56 rounded-xl border border-soft-200 p-2">
<FilterList label="Status">
<FilterListItem active count={128}>All</FilterListItem>
<FilterListItem count={42}>Active</FilterListItem>
<FilterListItem count={12}>Draft</FilterListItem>
<FilterListItem count={74}>Archived</FilterListItem>
</FilterList>
</div>
)
}Horizontal Filter
Toolbar patterns from Figma: Calendar type (date range + search) and Table type (segmented status + sort).
import {
Button,
ButtonGroup,
ButtonGroupItem,
TextInput,
Icon,
} from "@nili/ui"
import {
RiCalendarLine,
RiArrowDownSLine,
RiSortDesc,
RiSearch2Line,
} from "@remixicon/react"
export function Example() {
return (
<>
{/* Type · Calendar */}
<div className="flex flex-wrap items-center gap-3">
<Button size="sm" appearance="stroke" color="neutral">
Today
</Button>
<ButtonGroup size="sm" label="Date">
<ButtonGroupItem endIcon={<Icon icon={RiArrowDownSLine} />}>
Last 7 days
</ButtonGroupItem>
<ButtonGroupItem startIcon={<Icon icon={RiCalendarLine} />}>
Aug 04 - Aug 11 2023
</ButtonGroupItem>
</ButtonGroup>
<TextInput
size="sm"
aria-label="Search"
placeholder="Search..."
startIcon={<Icon icon={RiSearch2Line} />}
shortcut="⌘1"
className="w-[220px]"
/>
</div>
{/* Type · Table */}
<div className="flex flex-wrap items-center gap-3">
<ButtonGroup size="sm" label="Type">
<ButtonGroupItem selected>All</ButtonGroupItem>
<ButtonGroupItem>Income</ButtonGroupItem>
<ButtonGroupItem>Expenses</ButtonGroupItem>
</ButtonGroup>
<Button
size="sm"
appearance="stroke"
color="neutral"
startIcon={<Icon icon={RiSortDesc} />}
endIcon={<Icon icon={RiArrowDownSLine} />}
>
Sort by
</Button>
</div>
</>
)
}Vertical Filter Items
Default, hover (CSS) and active states for a single sidebar item.
import { FilterListItem, Icon } from "@nili/ui"
import { RiCalendarLine } from "@remixicon/react"
export function Example() {
return (
<>
<FilterListItem startIcon={<Icon icon={RiCalendarLine} />}>
Date
</FilterListItem>
<FilterListItem startIcon={<Icon icon={RiCalendarLine} />} active>
Date
</FilterListItem>
</>
)
}FilterBar
extends ComponentPropsWithoutRef<'div'>
Variant axes — from the component’s cva definition
| Prop | Type | Default | Notes |
|---|---|---|---|
| surface | plain | panel | plain |
Other props
| Prop | Type | Default | Notes |
|---|---|---|---|
| children | ReactNode | — | |
| aria-label | string | — | |
| label | string | — | Accessible name for the group, e.g. "Table filters". |
FilterChip
extends Omit< ComponentPropsWithoutRef<'button'>, 'value' >
Variant axes — from the component’s cva definition
| Prop | Type | Default | Notes |
|---|---|---|---|
| size | sm | md | sm | `sm` (32px) matches the Figma toolbar row. |
| active | boolean | false | A value is set. Renders `aria-pressed` so the state is announced. |
| placeholder | boolean | false | Dashed outline — an empty "add filter" affordance. |
Other props
| Prop | Type | Default | Notes |
|---|---|---|---|
| children | ReactNode | — | |
| disabled | boolean | — | |
| required | boolean | — | |
| readOnly | boolean | — | |
| value | ReactNode | — | The chosen value, shown after the label. |
| defaultValue | string | — | |
| name | string | — | |
| aria-label | string | — | |
| startIcon | ReactNode | — | |
| onClear | () => void | — | Shows a clear button. Requires `clearLabel`. |
| clearLabel | string | Clear |
FilterChipClear
internalVariant axes — from the component’s cva definition
| Prop | Type | Default | Notes |
|---|---|---|---|
| size | sm | md | sm |
FilterList
extends ComponentPropsWithoutRef<'div'>
Other props
| Prop | Type | Default | Notes |
|---|---|---|---|
| children | ReactNode | — | |
| aria-label | string | — | |
| label | string | — |
FilterListItem
extends ComponentPropsWithoutRef<'button'>
Variant axes — from the component’s cva definition
| Prop | Type | Default | Notes |
|---|---|---|---|
| active | boolean | false |
Other props
| Prop | Type | Default | Notes |
|---|---|---|---|
| children | ReactNode | — | |
| disabled | boolean | — | |
| required | boolean | — | |
| readOnly | boolean | — | |
| value | string | — | |
| defaultValue | string | — | |
| name | string | — | |
| aria-label | string | — | |
| startIcon | ReactNode | — | |
| count | ReactNode | — | Count chip at the trailing edge — pass a `<Badge>` or plain text. |