React
Component
Section titled “Component”Properties
Section titled “Properties”| Prop | Type | Description | Required |
|---|---|---|---|
label |
string |
Label for the chip | ✅ |
size |
Size |
Defines the size of the chip | |
className |
ClassValue |
Custom classNames you want to apply on the chip button | |
isSelected |
boolean |
Indicates if the chip is currently selected | |
leadingIcon |
ToyotaIcon | LexusIcon |
Icon displayed before the text | |
trailingIcon |
ToyotaIcon | LexusIcon |
Icon displayed after the text | |
dropdown |
ChipDropdown |
Custom settings for dropdown |
ChipDropdown
Section titled “ChipDropdown”| Prop | Type | Description | Required |
|---|---|---|---|
options |
ChipDropdownOption[] |
Options shown in the dropdown | ✅ |
clearAllLabel |
string |
Label for the clear button | |
onApply |
(value: string[]) => void |
Called with selected values on apply | |
applyLabel |
(count: number) => string |
Label for the apply button, based on count |
ChipDropdownOption
Section titled “ChipDropdownOption”Each option in the options array follows this shape:
| Prop | Type | Description | Required |
|---|---|---|---|
label |
string |
Text shown for the option | ✅ |
value |
string |
Value for the option | ✅ |
Example
Section titled “Example”import { Chip } from '@tmedxp/react-components';
const ChipExample = () => { return <Chip label="Label" />;};
export { ChipExample };import { Chip } from '@tmedxp/react-components';
const ChipDropDownExample = () => { return ( <Chip label="Label" dropdown={{ options: [ { label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }, { label: 'Option 3', value: '3' }, ], clearAllLabel: 'Clear all', applyLabel: (count) => count ? `Show ${count} results` : 'Show results', }} /> );};
export { ChipDropDownExample };