[go: up one dir, main page]

Skip to content

Chip API

API reference docs for the React Chip component. Learn about the props, CSS, and other APIs of this exported module.

DemosImport
import Chip from '@mui/material/Chip';
// or
import { Chip } from '@mui/material';

Learn about the difference by reading this guide on minimizing bundle size.



Chips represent complex entities in small blocks, such as a contact.

Props

Props of the native component are also available.

NameTypeDefaultDescription
avatarelement-

The Avatar element to display.

childrenunsupportedProp-

This prop isn't supported. Use the component prop if you need to change the children structure.

classesobject-

Override or extend the styles applied to the component.

See CSS classes API below for more details.

clickablebool-

If true, the chip will appear clickable, and will raise when pressed, even if the onClick prop is not defined. If false, the chip will not appear clickable, even if onClick prop is defined. This can be used, for example, along with the component prop to indicate an anchor Chip is clickable. Note: this controls the UI and does not affect the onClick event.

color'default'
| 'primary'
| 'secondary'
| 'error'
| 'info'
| 'success'
| 'warning'
| string
'default'

The color of the component. It supports both default and custom theme colors, which can be added as shown in the palette customization guide.

componentelementType-

The component used for the root node. Either a string to use a HTML element or a component.

deleteIconelement-

Override the default delete icon element. Shown only if onDelete is set.

disabledboolfalse

If true, the component is disabled.

iconelement-

Icon element.

labelnode-

The content of the component.

onDeletefunc-

Callback fired when the delete icon is clicked. If set, the delete icon will be shown.

size'medium'
| 'small'
| string
'medium'

The size of the component.

skipFocusWhenDisabledboolfalse

If true, allows the disabled chip to escape focus. If false, allows the disabled chip to receive focus.

sxArray<func
| object
| bool>
| func
| object
-

The system prop that allows defining system overrides as well as additional CSS styles.

See the `sx` page for more details.

variant'filled'
| 'outlined'
| string
'filled'

The variant to use.

The ref is forwarded to the root element.
Theme default props

You can use MuiChip to change the default props of this component with the theme.

CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

Class nameRule nameDescription
.Mui-disabledState class applied to the root element if disabled={true}.
.Mui-focusVisibleState class applied to the root element if keyboard focused.
.MuiChip-avataravatarStyles applied to the avatar element.
.MuiChip-avatarColorPrimaryavatarColorPrimaryStyles applied to the avatar element if color="primary".
.MuiChip-avatarColorSecondaryavatarColorSecondaryStyles applied to the avatar element if color="secondary".
.MuiChip-avatarMediumavatarMediumStyles applied to the avatar element if size="medium".
.MuiChip-avatarSmallavatarSmallStyles applied to the avatar element if size="small".
.MuiChip-clickableclickableStyles applied to the root element if onClick is defined or clickable={true}.
.MuiChip-clickableColorPrimaryclickableColorPrimaryStyles applied to the root element if onClick and color="primary" is defined or clickable={true}.
.MuiChip-clickableColorSecondaryclickableColorSecondaryStyles applied to the root element if onClick and color="secondary" is defined or clickable={true}.
.MuiChip-colorDefaultcolorDefaultStyles applied to the root element if color="default".
.MuiChip-colorErrorcolorErrorStyles applied to the root element if color="error".
.MuiChip-colorInfocolorInfoStyles applied to the root element if color="info".
.MuiChip-colorPrimarycolorPrimaryStyles applied to the root element if color="primary".
.MuiChip-colorSecondarycolorSecondaryStyles applied to the root element if color="secondary".
.MuiChip-colorSuccesscolorSuccessStyles applied to the root element if color="success".
.MuiChip-colorWarningcolorWarningStyles applied to the root element if color="warning".
.MuiChip-deletabledeletableStyles applied to the root element if onDelete is defined.
.MuiChip-deletableColorPrimarydeletableColorPrimaryStyles applied to the root element if onDelete and color="primary" is defined.
.MuiChip-deletableColorSecondarydeletableColorSecondaryStyles applied to the root element if onDelete and color="secondary" is defined.
.MuiChip-deleteIcondeleteIconStyles applied to the deleteIcon element.
.MuiChip-deleteIconColorPrimarydeleteIconColorPrimaryStyles applied to the deleteIcon element if color="primary".
.MuiChip-deleteIconColorSecondarydeleteIconColorSecondaryStyles applied to the deleteIcon element if color="secondary".
.MuiChip-deleteIconFilledColorPrimarydeleteIconFilledColorPrimaryStyles applied to the deleteIcon element if color="primary" and variant="filled".
.MuiChip-deleteIconFilledColorSecondarydeleteIconFilledColorSecondaryStyles applied to the deleteIcon element if color="secondary" and variant="filled".
.MuiChip-deleteIconMediumdeleteIconMediumStyles applied to the deleteIcon element if size="medium".
.MuiChip-deleteIconOutlinedColorPrimarydeleteIconOutlinedColorPrimaryStyles applied to the deleteIcon element if color="primary" and variant="outlined".
.MuiChip-deleteIconOutlinedColorSecondarydeleteIconOutlinedColorSecondaryStyles applied to the deleteIcon element if color="secondary" and variant="outlined".
.MuiChip-deleteIconSmalldeleteIconSmallStyles applied to the deleteIcon element if size="small".
.MuiChip-filledfilledStyles applied to the root element if variant="filled".
.MuiChip-filledPrimaryfilledPrimaryStyles applied to the root element if variant="filled" and color="primary".
.MuiChip-filledSecondaryfilledSecondaryStyles applied to the root element if variant="filled" and color="secondary".
.MuiChip-iconiconStyles applied to the icon element.
.MuiChip-iconColorPrimaryiconColorPrimaryStyles applied to the icon element if color="primary".
.MuiChip-iconColorSecondaryiconColorSecondaryStyles applied to the icon element if color="secondary".
.MuiChip-iconMediumiconMediumStyles applied to the icon element if size="medium".
.MuiChip-iconSmalliconSmallStyles applied to the icon element if size="small".
.MuiChip-labellabelStyles applied to the label span element.
.MuiChip-labelMediumlabelMediumStyles applied to the label span element if size="medium".
.MuiChip-labelSmalllabelSmallStyles applied to the label span element if size="small".
.MuiChip-outlinedoutlinedStyles applied to the root element if variant="outlined".
.MuiChip-outlinedPrimaryoutlinedPrimaryStyles applied to the root element if variant="outlined" and color="primary".
.MuiChip-outlinedSecondaryoutlinedSecondaryStyles applied to the root element if variant="outlined" and color="secondary".
.MuiChip-rootrootStyles applied to the root element.
.MuiChip-sizeMediumsizeMediumStyles applied to the root element if size="medium".
.MuiChip-sizeSmallsizeSmallStyles applied to the root element if size="small".

You can override the style of the component using one of these customization options:

Source code

If you did not find the information in this page, consider having a look at the implementation of the component for more detail.