Introduction
Chips allow users to enter information, make selections, filter content, or trigger actions. While included here as a standalone component, the most common use will be in some form of input, so some of the behavior demonstrated here is not shown in context.Basic Usage
Chip Variants
The Chip component supports two variants:filled (default) and outlined.
Chip Actions
You can use the following actions with chips:- Chips with the
onClickprop defined become clickable - Chips with the
onDeleteprop defined will display a delete icon
Clickable Chips
Chips can be made explicitly clickable using theclickable prop. This affects the styling even if no onClick handler is provided.
Clickable Link
You can also use chips as links by providing acomponent prop.
Custom Delete Icon
You can customize the delete icon using thedeleteIcon prop.
Chip Adornments
You can add icons or avatars to the beginning of the chip using theicon and avatar props.
Color
Thecolor prop supports all theme palette colors.
Sizes
The Chip component supports two sizes:medium (default) and small.
Chip Array
An example of rendering multiple chips from an array of values, with the ability to delete chips.Props
Chip Props
| Prop | Type | Default | Description |
|---|---|---|---|
avatar | element | - | The Avatar element to display. |
clickable | boolean | - | If true, the chip will appear clickable, even if onClick is not defined. |
color | 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'default' | The color of the component. Supports theme palette colors. |
deleteIcon | element | - | Override the default delete icon element. Shown only if onDelete is set. |
disabled | boolean | false | If true, the component is disabled. |
icon | element | - | Icon element. |
label | node | - | The content of the component. |
onDelete | function | - | Callback fired when the delete icon is clicked. If set, the delete icon will be shown. |
size | 'small' | 'medium' | 'medium' | The size of the component. |
skipFocusWhenDisabled | boolean | false | If true, allows the disabled chip to escape focus. |
sx | SxProps<Theme> | - | The system prop for defining CSS overrides and additional styles. |
variant | 'filled' | 'outlined' | 'filled' | The variant to use. |
Slots
| Slot | Type | Default | Description |
|---|---|---|---|
root | ElementType | 'div' | The component that renders the root. |
label | ElementType | 'span' | The component that renders the label. |
CSS Classes
The following CSS classes are available for customization:.MuiChip-root- Styles applied to the root element..MuiChip-filled- Styles applied to the root element ifvariant="filled"..MuiChip-outlined- Styles applied to the root element ifvariant="outlined"..MuiChip-clickable- Styles applied to the root element ifclickable={true}..MuiChip-deletable- Styles applied to the root element ifonDeleteis defined..MuiChip-sizeSmall- Styles applied to the root element ifsize="small"..MuiChip-sizeMedium- Styles applied to the root element ifsize="medium"..MuiChip-colorPrimary- Styles applied to the root element ifcolor="primary"..MuiChip-colorSecondary- Styles applied to the root element ifcolor="secondary"..MuiChip-disabled- Styles applied to the root element ifdisabled={true}..MuiChip-icon- Styles applied to the icon element..MuiChip-label- Styles applied to the label span element..MuiChip-avatar- Styles applied to the avatar element..MuiChip-deleteIcon- Styles applied to the deleteIcon element.
Accessibility
If the Chip is deletable or clickable then it is a button in tab order. When focused (e.g., when tabbing) releasing (keyup event) Backspace or Delete will call the onDelete handler while releasing Escape will blur the Chip.