Getting Started
Components
- Advanced Toast
- ArrowButton
- Arrows
- Avatar
- Backdrop
- Basic Toast
- Breadcrumb
- Button
- CardBackground
- Card
- Carousel
- ChatButton
- ChatInput
- ChatMessage
- ChatTypingIndicator
- ChatWindow
- CheckboxSelect
- Checkbox
- Checkboxes
- Chip
- ChoiceExpander
- Clickable
- Date Field
- Dropdown
- ElasticHeight
- ExpandableCard
- Filter
- Form Control
- Form Label
- Frame
- HamburgerIcon
- Heading
- Image
- Link
- Loader
- Number Field
- Pagination
- Password
- Phone Field
- Popin
- Portal
- Prose
- Radio Group
- Radio
- Range
- Scrollbar
- Select
- SidebarLayout
- SliderFrame
- Spinner
- Switch
- Tabs
- Tag
- TextField
- Tooltip
- ValidationMessage
'use client';
import { Filter } from '@/ui/forms/Filter';
import { Icon } from '@clubmed/trident-icons';
export function FilterDemo() {
return (
<Filter checked={false}>
<div className="flex items-center gap-x-8">
<Icon name="Filters" />
Category Filter
</div>
</Filter>
);
}
Installation
npx shadcn@latest add https://develop.trident-ui.pro.clubmed/r/filter.json
Usage
'use client';
import { useState } from 'react';
import { Filter } from '@/docs/lib/ui/forms/filter';
export function Component() {
const [checked, setChecked] = useState(false);
return (
<Filter
name="category"
checked={checked}
onChange={(event) => setChecked(event.target.checked)}
>
Category Filter
</Filter>
);
}API Reference
Filter
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | undefined | Label content displayed next to icons |
hasDropdown | boolean | undefined | Displays a dropdown arrow icon when true |
dataTestId | string | undefined | Deprecated alias for data-testid |
data-testid | string | undefined | Test identifier forwarded to the native input |
className | string | undefined | Additional classes on the outer wrapper |
onChange | (event: ChangeEvent<HTMLInputElement>) => void | undefined | Native checkbox onChange handler |
Filter also supports standard HTML input attributes (checked, defaultChecked, name, value, disabled, etc.).
Notes
- Checkbox-based: Filter is built on a native checkbox input, providing proper semantics and keyboard accessibility out of the box
- Check icon: When checked, displays a check icon (CheckDefault) to indicate the selected state
- Dropdown indicator: Set
hasDropdown={true}to show an arrow icon, useful when the filter opens a dropdown menu - Native events:
onChangeuses the native checkbox event signature - Composability: Can be used directly inside
Checkboxesfor grouped selection behavior - Disabled state: When disabled, prevents clicks and keyboard interactions
- Data attributes: Includes
data-name="Filter"for styling anddata-testidfor testing - Keyboard support: Fully keyboard accessible with configurable
tabIndex