Chip
Chip shows a short word or a count that tells you the current state of the thing beside it.
A chip shows a short word or a count that says what state the thing beside it is in, such as Running, Failed or Deployed. It has the same grey fill, corner and one-line height as Code and Kbd.
Use a chip for a status in a list, a table or next to a title. To show a dot or a count on an avatar or an icon, use a Badge. For something that people can press or remove, use a Button, and for a message about a condition, use a Notice.
tone sets the colour of the letters, and the box stays grey in every tone. Use success for a finished job, destructive for a failed one, warning for one that needs attention and info for one that is running. Use the same tone for the same word everywhere in your product.
size is optional. If you leave it unset, the chip matches the text size of the line it sits in, so a chip beside a large heading is larger than one in a table row. Set size only when the chip stands alone. weight and emphasis work as they do on Text and change only the letters.
Set backdrop when the chip sits over an image or other content that passes behind it, so the chip uses your Theme's material. On a plain background, it stays solid.
A chip is plain text, and a screen reader reads its word as part of the line. The colour adds meaning but cannot replace it, so write a word that makes sense on its own. A chip with no content, such as {false} or an empty string, renders nothing.
- Badge when the mark stays until the person looks, such as an unread count.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
backdrop? | boolean | Set backdrop when the chip sits over other content, such as an image or a map. |
children | React.ReactNode | The word or the number in the chip. |
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
emphasis? | "loud" | "medium" | "quiet" | The emphasis level of the text: loud, medium or quiet. |
render? | RenderElement | Renders the chip as a different element. |
size? | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | The text size step of the chip, from 1 to 9. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
tone? | "neutral" | "accent" | "destructive" | "blue" | "green" | "orange" | "amber" | "pink" | "purple" | "success" | "warning" | "info" | The category of the chip, which sets its text colour. |
weight? | "regular" | "medium" | "semibold" | The font weight, by name. |
It also takes every prop of a <span>.
- A louder fill, or a
variantprop — A chip's tone says what kind of state something is in, not how important it is, so every chip has the same strength. To make one item stand out, use its position on the screen or a Button'semphasis. - A remove button — A chip that people can remove is a control, which needs focus, a keyboard model and an accessible name. Use a Button when people must act on the item.
- A count prop — A chip shows exactly what you give it. Format the number and choose a cut-off, such as 99+, in your app.
- A position of its own — A chip does not decide where it sits on the screen. Place it in a row, a table cell or a Box.
- An empty chip — A chip with no word is only a coloured shape, and colour alone cannot carry a meaning. For a dot or a count, use a Badge.