Skip to main content

Common Examples

import { Chip } from "@servicetitan/anvil2";

function ExampleComponent() {
  return (
    <Chip
      label="Cassian Andor"
      size="medium"
      color="#3e3e5f"
      onClick={console.log}
      onClose={console.log}
    />
  );
}

Basic Chip

Chip components must at least have their label prop defined, which will define the text that is displayed within the Chip.

Closeable Chip

Adding an onClose prop handler to the Chip component will render a clickable close button alongside the Chip.

Clickable Chip

Adding an onClick prop handler to the Chip component will render the text inside the Chip as a clickable button.

Chip with Avatar

Adding an avatar prop with a URL to an image will render an Avatar inside of the Chip as a prefix before the label. Note that the avatar prop cannot be used with the icon prop.

Chip with Icon

Adding an icon prop with an imported SVG will render an Icon inside of the Chip as a prefix before the label. Note that the icon prop cannot be used with the avatar prop.

React Accessibility

  • The Chip component won’t be focusable unless it has an onClick or onClose prop handler defined.
For more guidance on accessible interaction components, see button accessibility best practices.
Last modified on January 23, 2026