🔥 New blog post: The best way to use icons in Web UIs
What if I told you, you could use CSS to *insert* and *tweak* icons without touching any HTML?
And that you can manage them alongside your other design tokens?
🔥 New blog post: The best way to use icons in Web UIs
What if I told you, you could use CSS to *insert* and *tweak* icons without touching any HTML?
And that you can manage them alongside your other design tokens?
I like/use the semantic nature of "this button is class=delete" and then letting the CSS draw icons (whether Wastebasket emoji or an SVG, but please no icon-fonts because they break when Firefox enforces my own readable fonts and I get something like "ß" that sites attempt to visually override as a trash-can icon) and choose colors appropriately.
But I find it a bit unfortunate to suggest intermingling one-off icons directly into the HTML. Better to promote the one-off to a full-fledged class and use that semantically.
Sticking to pure class=classname in the HTML should also resolve the "branching between these three" issue you mention/defer. The HTML becomes responsible only for "this is a class=XYZ" and the CSS is responsible for "this is what .XYZ looks like" whether it uses content=emoji or SVG icons or whatever.
@gumnos That's up to the icon system user.
The icon system allows either pattern. But also, there are perfectly valid cases for one-off icons (e.g. an icon palette!)
@leaverou Yep, style queries with non-inherited custom properties is a nice way to do mixins. Bugs notwithstanding :D
Re: vertical-align: https://blog.kizu.dev/cap-height-align/
(and yep, can’t wait for the linked parameters — although in their absence there are also other ways aside from the masks that could make those more dynamic haha — https://kizu.dev/svg-linked-parameters-workaround/)
@kizu Ha, some of this is basically what I was planning to discuss in the icon animation followup! Of course you got there first lol. I'll send you a draft when that post is ready for review!
@kizu Thanks, I just updated the post to use this (linking to your post), and released a new version of @nudeui/icons that uses it!
@leaverou I thought I was happy just dropping references to SVGs via `use` but your reminder that I have to use an entirely different technique to style `:marker`s means I'll be digging into this on <current project>
@devolute ::marker may be a little limited in the properties it allows for this, so you may still need to recreate markers with ::before. But that's true for most heavily customized markers anyway…
@leaverou I love your deep dives, like this one and the one on bundlers, because you state the goals upfront and then try every single thing to try and achieve them. I end up learning so much. Thanks!