A Tailwind CSS plugin for working with Google's Material Symbols #18637
savaryna
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
Looks great! I might have to give this a go this weekend. You might want to have a look at this library we are using to load the actual symbol variable font files into our project. These packages are automatically updated when Google's source updates too. https://github.com/marella/material-symbols/tree/main/material-symbols#readme You can scope the css import to only load the "rounded" font etc or go even further with different packages that include a single weight. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey 👋,
I'm the creator of a Tailwind CSS plugin offering utility classes for Google's Material Symbols. These days I got around to updating it to the CSS first approach of Tailwind CSS v4. It still supports v3 through the legacy JS plugins, so maybe it could also serve as an insight into how you could achieve the same.
For a quick intro, what this plugin does, it allows you to use utility classes to style the Material Symbols font.
This example code will result in an icon with a size of
48px
and a matching optical size, a700
stroke weight and recommended grade for dark backgrounds. There is a utility for every variation offered by the symbols.To use it, install using:
then import it in your main
.css
file:Alternatively you can also use:
if your environment does not support the conditional export.
For a full set of what utilities are exposed and how you can use them with other Tailwind CSS features, like transitions and pseudo selectors, check out the demo site and repo.
I'm also interested in how useful people find something like this, so feel free to leave your feedback down below.
To me this is more of a learning experience and I could also write an article on how to approach "plugin" development for v4 if people are interested. (I might just write it anyways)
Beta Was this translation helpful? Give feedback.
All reactions