
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-ui-chip-filter
Advanced tools
A flexible React component for filtering content using interactive chips
A flexible and customizable React component for filtering content using interactive chips. Perfect for creating filter interfaces in e-commerce, dashboards, and data visualization applications.


npm install react-ui-chip-filter
yarn add react-ui-chip-filter
This package supports multiple React setups:
import { FilterChips, FilterChip } from 'react-ui-chip-filter';
import 'react-ui-chip-filter/styles';
import { FilterChips } from 'react-ui-chip-filter';
import 'react-ui-chip-filter/styles';
const { FilterChips } = require('react-ui-chip-filter');
require('react-ui-chip-filter/dist/index.css');
import { FilterChips } from 'react-ui-chip-filter/dist/index.esm.js';
import 'react-ui-chip-filter/dist/index.css';
import React, { useState } from 'react';
import { FilterChips, FilterChip } from 'react-ui-chip-filter';
const data = [
{ id: 1, name: 'John Doe', category: 'Developer', skills: ['React', 'TypeScript'] },
{ id: 2, name: 'Jane Smith', category: 'Designer', skills: ['Figma', 'Sketch'] },
{ id: 3, name: 'Bob Johnson', category: 'Developer', skills: ['Vue', 'JavaScript'] },
];
const chips: FilterChip[] = [
{ id: 'dev', label: 'Developers', value: 'Developer' },
{ id: 'design', label: 'Designers', value: 'Designer' },
{ id: 'react', label: 'React', value: 'React' },
];
function App() {
const [filteredData, setFilteredData] = useState(data);
const handleChipClick = (chip: FilterChip, filtered: any[]) => {
setFilteredData(filtered);
};
return (
<div>
<FilterChips
chips={chips}
onChipClick={handleChipClick}
data={data}
filterKey="category"
multiSelect={true}
/>
<div>
{filteredData.map(item => (
<div key={item.id}>{item.name}</div>
))}
</div>
</div>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
chips | FilterChip[] | Required | Array of chip objects to display |
onChipClick | (chip: FilterChip, filteredData: any[]) => void | Required | Callback fired when a chip is clicked |
data | any[] | Required | Array of data to filter |
filterKey | string | string[] | Required | Key(s) to filter by in the data objects |
multiSelect | boolean | false | Allow multiple chips to be selected |
className | string | '' | CSS class for the container |
chipClassName | string | '' | CSS class for individual chips |
activeChipClassName | string | '' | CSS class for active chips |
disabledChipClassName | string | '' | CSS class for disabled chips |
style | React.CSSProperties | undefined | Inline styles for the container |
chipStyle | React.CSSProperties | undefined | Inline styles for individual chips |
showClearAll | boolean | true | Show clear all button |
clearAllText | string | 'Clear All' | Text for clear all button |
clearAllClassName | string | '' | CSS class for clear all button |
maxChips | number | undefined | Maximum number of chips to show initially |
showMoreText | string | 'Show More' | Text for show more button |
showLessText | string | 'Show Less' | Text for show less button |
searchable | boolean | false | Enable search functionality |
searchPlaceholder | string | 'Search chips...' | Placeholder for search input |
searchClassName | string | '' | CSS class for search input |
noResultsText | string | 'No chips found' | Text when no chips match search |
loading | boolean | false | Show loading state |
loadingText | string | 'Loading...' | Text for loading state |
| Property | Type | Default | Description |
|---|---|---|---|
id | string | Required | Unique identifier for the chip |
label | string | Required | Display text for the chip |
value | any | Required | Value to filter by |
active | boolean | false | Whether the chip is initially active |
disabled | boolean | false | Whether the chip is disabled |
color | string | undefined | Text color for the chip |
backgroundColor | string | undefined | Background color for the chip |
borderColor | string | undefined | Border color for the chip |
const products = [
{
id: 1,
name: 'Wireless Headphones',
category: 'Electronics',
brand: 'TechSound',
price: 99.99,
tags: ['wireless', 'bluetooth']
},
// ... more products
];
const categoryChips: FilterChip[] = [
{ id: 'electronics', label: 'Electronics', value: 'Electronics' },
{ id: 'accessories', label: 'Accessories', value: 'Accessories' },
];
const brandChips: FilterChip[] = [
{ id: 'techsound', label: 'TechSound', value: 'TechSound' },
{ id: 'gamepro', label: 'GamePro', value: 'GamePro' },
];
function ProductFilters() {
const [filteredProducts, setFilteredProducts] = useState(products);
return (
<div>
<h3>Filter by Category</h3>
<FilterChips
chips={categoryChips}
onChipClick={(chip, filtered) => setFilteredProducts(filtered)}
data={products}
filterKey="category"
multiSelect={true}
/>
<h3>Filter by Brand</h3>
<FilterChips
chips={brandChips}
onChipClick={(chip, filtered) => setFilteredProducts(filtered)}
data={products}
filterKey="brand"
multiSelect={true}
maxChips={3}
searchable={true}
/>
</div>
);
}
const customChips: FilterChip[] = [
{
id: 'high',
label: 'High Priority',
value: 'high',
backgroundColor: '#ff6b6b',
color: '#ffffff'
},
{
id: 'medium',
label: 'Medium Priority',
value: 'medium',
backgroundColor: '#ffa726',
color: '#ffffff'
},
];
<FilterChips
chips={customChips}
onChipClick={handleChipClick}
data={data}
filterKey="priority"
className="custom-priority-chips"
chipClassName="custom-chip"
activeChipClassName="custom-active"
/>
const data = [
{ id: 1, name: 'John', skills: ['React', 'TypeScript', 'Node.js'] },
{ id: 2, name: 'Jane', skills: ['Vue', 'JavaScript'] },
{ id: 3, name: 'Bob', skills: ['React', 'Python'] },
];
const skillChips: FilterChip[] = [
{ id: 'react', label: 'React', value: 'React' },
{ id: 'vue', label: 'Vue', value: 'Vue' },
{ id: 'typescript', label: 'TypeScript', value: 'TypeScript' },
];
<FilterChips
chips={skillChips}
onChipClick={handleChipClick}
data={data}
filterKey="skills" // This will filter arrays
multiSelect={true}
/>
<FilterChips
chips={chips}
onChipClick={handleChipClick}
data={data}
filterKey={['category', 'department']} // Filter by multiple keys
multiSelect={true}
/>
The component comes with default styles, but you can easily customize them:
/* Custom container styles */
.custom-filter-container {
background: #f8f9fa;
padding: 20px;
border-radius: 8px;
}
/* Custom chip styles */
.custom-chip {
border-radius: 25px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
/* Custom active chip styles */
.custom-active-chip {
transform: scale(1.05);
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
/* Custom search input styles */
.custom-search-input {
border: 2px solid #007bff;
border-radius: 8px;
}
The component includes built-in accessibility features:
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see the LICENSE file for details.
// App.js
import React, { useState } from 'react';
import { FilterChips } from 'react-ui-chip-filter';
import 'react-ui-chip-filter/styles';
function App() {
const [data, setData] = useState([
{ id: 1, name: 'Product 1', category: 'Electronics' },
{ id: 2, name: 'Product 2', category: 'Clothing' },
]);
const chips = [
{ id: 'electronics', label: 'Electronics', value: 'Electronics' },
{ id: 'clothing', label: 'Clothing', value: 'Clothing' },
];
return (
<FilterChips
chips={chips}
onChipClick={(chip, filtered) => setData(filtered)}
data={data}
filterKey="category"
/>
);
}
// pages/index.tsx
import { useState } from 'react';
import { FilterChips, FilterChip } from 'react-ui-chip-filter';
import 'react-ui-chip-filter/styles';
export default function HomePage() {
const [data, setData] = useState([
{ id: 1, name: 'Product 1', category: 'Electronics' },
]);
const chips: FilterChip[] = [
{ id: 'electronics', label: 'Electronics', value: 'Electronics' },
];
return (
<FilterChips
chips={chips}
onChipClick={(chip, filtered) => setData(filtered)}
data={data}
filterKey="category"
/>
);
}
// src/App.tsx
import { useState } from 'react';
import { FilterChips, FilterChip } from 'react-ui-chip-filter';
import 'react-ui-chip-filter/styles';
function App() {
const [data, setData] = useState([
{ id: 1, name: 'Product 1', category: 'Electronics' },
]);
const chips: FilterChip[] = [
{ id: 'electronics', label: 'Electronics', value: 'Electronics' },
];
return (
<FilterChips
chips={chips}
onChipClick={(chip, filtered) => setData(filtered)}
data={data}
filterKey="category"
/>
);
}
FAQs
A flexible React component for filtering content using interactive chips
We found that react-ui-chip-filter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.