19.13.0 • Published 8 months ago
@commercetools-uikit/quick-filters v19.13.0
QuickFilters
Description
The QuickFilters
component displays a selection of Tag
components that represent the available filter actions.
Installation
yarn add @commercetools-uikit/quick-filters
npm --save install @commercetools-uikit/quick-filters
Additionally install the peer dependencies (if not present)
yarn add react
npm --save install react
Usage
import { useState } from 'react';
import QuickFilters from '@commercetools-uikit/quick-filters';
const App = () => {
const [items, setItems] = useState([
{
id: '1',
label: 'Accepted',
isActive: true,
},
{
id: '2',
label: 'Rejected',
isActive: false,
},
]);
const onItemClick = (clickedItem) => {
const updatedItems = items.map((item) => {
return {
...item,
isActive: item.id === clickedItem.id ? !item.isActive : false,
};
});
setItems(updatedItems);
};
return <QuickFilters items={items} onItemClick={onItemClick} />;
};
export default App;
Properties
Props | Type | Required | Default | Description |
---|---|---|---|---|
items | Array: TQuickFiltersItem[] See signature. | ✅ | collection of quick filter items@param item.id unique identifier for the item. @param item.label label to display @param item.isActive the current active state of the item | |
onItemClick | Function See signature. | ✅ | callback fn, executed when an item is clicked |
Signatures
Signature items
{
/** unique identifier for the item. */
id: string;
/* label to display */
label: string;
/* the current active state of the item */
isActive: boolean;
}
Signature onItemClick
(item: TQuickFiltersItem) => void
0.0.0-canary-20241028125808
8 months ago
0.0.0-preview-FCT-1187-20241024123200
8 months ago
0.0.0-preview-FCT-1187-20241021190428
8 months ago
19.13.0
8 months ago
0.0.0-canary-20241014160150
8 months ago
0.0.0-canary-20241011135231
9 months ago
0.0.0-canary-20241010205637
9 months ago
0.0.0-canary-20241010162605
9 months ago
0.0.0-canary-20241010130729
9 months ago
0.0.0-canary-20241009193324
9 months ago
0.0.0-canary-20241009175534
9 months ago
19.12.1
9 months ago
0.0.0-canary-20241009071024
9 months ago
19.12.0
9 months ago
0.0.0-canary-20241003153231
9 months ago
0.0.0-canary-20241003151043
9 months ago
0.0.0-canary-20241003145429
9 months ago
0.0.0-canary-20241002142913
9 months ago
0.0.0-canary-20241002142715
9 months ago
0.0.0-canary-20241002130953
9 months ago
0.0.0-canary-20241001174409
9 months ago