docs-bug(chips): MatChip does not natively support leading icon despite docs
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
### Documentation Feedback
The [documentation for MatChip](https://material.angular.dev/components/chips/overview#adding-up-to-two-icons-with-content-projection) states the following:
> 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 \.
This suggests two possible slots for a `` (leading or trailing the chip text). However, this doesn't work in practice, and looking at the [template code](https://github.com/angular/components/blob/main/src/material/chips/chip.html) suggests that the chip only supports an _avatar_ in the leading slot (despite the documentation stating "icon").
When you try to add an icon rather than an avatar, it's not aligned correctly. Adding the `matChipAvatar` directive doesn't help as the icon is clipped to a circle (and the alignment is still off).
In my opinion, a chip should support projecting an instance of `MatIcon` on the leading side (in fact, it's show in the [MD spec](https://m3.material.io/components/chips/overview)). However, as it stands the documentation is misleading as to the current behaviour.
https://stackblitz.com/edit/gqzwx38r?file=src%2Fexample%2Fchips-avatar-example.html
### Affected documentation page
https://material.angular.dev/components/chips/overview#adding-up-to-two-icons-with-content-projection
Contributor guide
Research direction
Start with the affected MatChip documentation section and compare its claims with src/material/chips/chip.html. Reproduce the reported behavior using the linked StackBlitz example, including the matChipAvatar case. Done means the documentation accurately reflects the supported leading-slot behavior and its examples no longer mislead users.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- documentation, frontend
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100