Chips allow users to view information, make selections, filter content, and enter data. ### Static Chips Chips are always used inside a container. To create chips, start with a `` element. Then, nest `` elements inside the ``. By default, `` renders a chip with Material Design styles applied. For a chip with no styles applied, use ``. #### Disabled appearance Although `` is not interactive, you can set the `disabled` Input to give it disabled appearance. ```html Orange ``` ### Selection Chips Use `` and `` for selecting one or many items from a list. Start with creating a `` element. If the user may select more than one option, add the `multiple` attribute. Nest a `` element inside the `` for each available option. #### Disabled `` Use the `disabled` Input to disable a ``. This gives the `` a disabled appearance and prevents the user from interacting with it. ```html Orange ``` #### Keyboard Interactions Users can move through the chips using the arrow keys and select/deselect them with space. Chips also gain focus when clicked, ensuring keyboard navigation starts at the currently focused chip. ### Chips connected to an input field Use `` and `` for assisting users with text entry. Chips are always used inside a container. To create chips connected to an input field, start by creating a `` as the container. Add an `` element, and register it to the `` by passing the `matChipInputFor` Input. Always use an `` element with ``. Nest a `` element inside the `` for each piece of data entered by the user. An example of using chips for text input. ### Use with `@angular/forms` Chips are compatible with `@angular/forms` and supports both `FormsModule` and `ReactiveFormsModule`. #### Disabled `` Use the `disabled` Input to disable a ``. This gives the `` a disabled appearance and prevents the user from interacting with it. ```html Orange ``` #### Keyboard Interactions Users can move through the chips using the arrow keys and select/deselect them with the space. Chips also gain focus when clicked, ensuring keyboard navigation starts at the appropriate chip. Users can press delete to remove a chip. Pressing delete triggers the `removed` Output on the chip, so be sure to implement `removed` if you require that functionality. #### Autocomplete A `` can be combined with `` to enable free-form chip input with suggestions. ### Icons You can add icons to chips to identify entities (like individuals) and provide additional functionality. #### Adding up to two icons with content projection You can add two additional icons to an individual chip. A chip has two slots to display icons using content projection. All variants of chips support adding icons including ``, ``, and ``. A chip has a front slot for adding an avatar image. To add an avatar, nest an element with `matChipAvatar` attribute inside of ``. You can add an additional icon to the back slot by nesting an element with either the `matChipTrailingIcon` or `matChipRemove` attribute. #### Remove Button Sometimes the end user would like the ability to remove a chip. You can provide that functionality using `matChipRemove`. `matChipRemove` renders to the back slot of a chip and triggers the `removed` Output when clicked. To create a remove button, nest a ` ``` See the [accessibility](#accessibility) section for best practices on implementing the `removed` Output and creating accessible icons. ### Orientation By default, chips are displayed horizontally. To stack chips vertically, apply the `mat-mdc-chip-set-stacked` class to ``, `` or ``. ### Specifying global configuration defaults Use the `MAT_CHIPS_DEFAULT_OPTIONS` token to specify default options for the chips module. ```html @NgModule({ providers: [ { provide: MAT_CHIPS_DEFAULT_OPTIONS, useValue: { separatorKeyCodes: [COMMA, SPACE] } } ] }) ``` ### Interaction Patterns The chips components support 3 user interaction patterns, each with its own container and chip elements: #### Listbox `` and `` : These elements implement a listbox accessibility pattern. Use them to present set of user selectable options. ```html Small Medium Large ``` #### Text Entry `` and `` : These elements implement a grid accessibility pattern. Use them as part of a free form input that allows users to enter text to add chips. ```html @for (filling of fillings; track filling) { {{filling.name}} } ``` #### Static Content `` and `` as an unordered list : Present a list of items that are not interactive. This interaction pattern mimics using `ul` and `li` elements. Apply role="list" to the ``. Apply role="listitem" to each ``. ```html Sugar Spice Everything Nice ``` `` and `` : These elements do not implement any specific accessibility pattern. Add the appropriate accessibility depending on the context. Note that Angular Material does not intend ``, ``, and `` to be interactive. ```html John Paul James ``` ### Accessibility The [Interaction Patterns](#interaction-patterns) section describes the three variants of chips available. Choose the chip variant that best matches your use case. For both MatChipGrid and MatChipListbox, always apply an accessible label to the control via `aria-label` or `aria-labelledby`. Always apply MatChipRemove to a `