Select filter
Genius
Billionaire
Playboy
Philanthropist
Vengeance
Installation
$ pnpm dlx shadcn@latest add https://pulseui-henna.vercel.app/registry/FilterSelector.json| Prop | Type | isCompulsory | Description |
|---|---|---|---|
items | {id: string; label: string}[] | true | the list of all the objects, each object has the name and id of a filter item |
onSelection | (values: number[]) => void | true | sets the array of all the applied filters, the array contains indices of the applied filters from the array items |
1export function Demo(){
2 const filterItems = [
3 {
4 id: "Genius",
5 label: "Genius",
6 },
7 {
8 id: "Billionaire",
9 label: "Billionaire",
10 },
11 {
12 id: "Playboy",
13 label: "Playboy",
14 },
15 {
16 id: "Philanthropist",
17 label: "Philanthropist",
18 },
19 {
20 id: "Vengeance",
21 label: "Vengeance",
22 },
23 ];
24 const [selectedList, setSelectedList] = useState<number[]>([]);
25
26 return (
27 <FilterSelector
28 items={filterItems}
29 onSelection={setSelectedList}
30 />
31 );
32}