You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: mat-chip without mat-chip-list has no styles #9964
P4A relatively minor issue that is not relevant to core functionsarea: material/chipsneeds: discussionFurther discussion with the team is needed before proceeding
This is happening because the mat-chip is a directive and without a view does not load styles or styleUrls. Once mat-chip-list is loaded, the chips styling is loaded and will be applied to all things it matches via css.
I'm pretty new to Angular and have only worked with AngularJS before. I wanted to try using the mat-chip-list component in a test project following the instructions on the official documentation but for some reason all of my chips receive the mat-basic-chip [edit: nevermind, it was mat-standard-chip] class and are thus unstyled. In addition they get extremely large for a second or so when I click them. This issue persists, even if I manually add styles for them, so this is my main issue, I guess.
I know it's not this exact issue but I felt it was related. Does anyone know what I'm missing...?
I have imported the module in my app.module.ts like so:
Btw. I tried it with <mat-chip-list> and styles are missing too (I mean, styles for primary/accent/warn color), it is something changed? See example here:
Just if someone's wondering the same issue - even wrapping up <mat-chip> by <mat-chip-list> still won't apply theme styling e.g. typography.
It turns out that you will need to again wrap the whole thing up by something else like <mat-card-content>.
If you don't want to use chips within a card, you can wrap it up by <mat-form-field>. But then there's an unwanted underline under the chips. You can eliminate it by doing:
Facing the same issue, adding <mat-chip-list></mat-chip-list> in template fixed it however it's a real time waste for a lot of people who encounter this problem for the first time. If it's not gonna be fixed then I will suggest it will be better to at least add an error message about <mat-chip-list> being a required parent for mat-chip
Reacted by Walter Sorenson, Denes Papp, abbasharoon, Aziz, Daniel, Paul Kim and Loïc ZHU
P4A relatively minor issue that is not relevant to core functionsarea: material/chipsneeds: discussionFurther discussion with the team is needed before proceeding
Activity
donroyco commentedon Feb 15, 2018
Weird thing is, when adding a
mat-chip-list, it works correctly for all mat-chips.josephperrott commentedon Feb 15, 2018
This is happening because the
mat-chipis a directive and without a view does not load styles or styleUrls. Oncemat-chip-listis loaded, the chips styling is loaded and will be applied to all things it matches via css.Manostion commentedon Jun 14, 2018
Heya,
I'm pretty new to Angular and have only worked with AngularJS before. I wanted to try using the
mat-chip-listcomponent in a test project following the instructions on the official documentation but for some reason all of my chips receive the[edit: nevermind, it wasmat-basic-chipmat-standard-chip] class and are thus unstyled. In addition they get extremely large for a second or so when I click them. This issue persists, even if I manually add styles for them, so this is my main issue, I guess.I know it's not this exact issue but I felt it was related. Does anyone know what I'm missing...?
I have imported the module in my
app.module.tslike so:...and my layout inside the
app.component.htmllooks something like this:Update / solved:
My bad, I forgot to include a prebuilt Angular Material theme...
striky1 commentedon Aug 7, 2018
Something new about that? Still not working. Thank you
Angular v6.0.0
Material v6.2.1
TypeScript v2.7.2
jelbourn commentedon Aug 7, 2018
Agreed that it would be nice to have chips without a chip-list, but currently this would be a low priority issue.
striky1 commentedon Aug 7, 2018
Thank you for your reply.
Btw. I tried it with
<mat-chip-list>and styles are missing too (I mean, styles for primary/accent/warn color), it is something changed? See example here:https://stackblitz.com/edit/angular-9vs2ga
Thank you.
frederikschubert commentedon Aug 14, 2018
@striky1 The colors only appear when the
selectedproperty is set on themap-chip.striky1 commentedon Aug 14, 2018
@frederikschubert oh, u are right! Thank you so much ;)
rivernews commentedon Sep 16, 2018
Just if someone's wondering the same issue - even wrapping up
<mat-chip>by<mat-chip-list>still won't apply theme styling e.g. typography.It turns out that you will need to again wrap the whole thing up by something else like
<mat-card-content>.If you don't want to use chips within a card, you can wrap it up by
<mat-form-field>. But then there's an unwanted underline under the chips. You can eliminate it by doing:For applying colors to chips like primary/accent/warn, as @frederikschubert mentioned, the
selectedproperty does the work.10 remaining items
lorenzocovarrubiasjr commentedon Sep 17, 2020
Having the same issue, any update?
am-awais commentedon Jan 25, 2021
this needs to be resolved ASAP, I mean its 2020 and Angular material bugs still exists :(
Frankkwizera commentedon Mar 23, 2021
Hey
any update on this issue?!
abbasharoon commentedon May 31, 2021
Facing the same issue, adding
<mat-chip-list></mat-chip-list>in template fixed it however it's a real time waste for a lot of people who encounter this problem for the first time. If it's not gonna be fixed then I will suggest it will be better to at least add an error message about<mat-chip-list>being a required parent format-chipDzivo commentedon Sep 5, 2021
Is this still a thing after all these years omg 🗡️
MoodyJW commentedon Oct 26, 2021
Bug sitting around for almost 4 years. Not sure if I should be impressed or disappointed.
crisbeto commentedon Dec 30, 2021
Will be fixed by #23931.
youssefkri commentedon May 26, 2022
26 may 2022 and still not fixed
fbalbinoribeiro commentedon Jul 22, 2022
2022-07-22 and still not fixed
alex-polosky commentedon Oct 11, 2023
2023-10-11 and still not fixed
The irony of myself not fixing open source code is not lost on me.
crisbeto commentedon Mar 20, 2024
As far as I can tell this is fixed. See https://stackblitz.com/edit/oekksb?file=src%2Fexample%2Fchips-overview-example.html. The issue can be reopened if there's a repro.
angular-automatic-lock-bot commentedon Apr 20, 2024
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.