Hello.
I want to use google material icons, how do I import them?
I’d appreciate detailed instructions on how to go about it!
Hello.
I want to use google material icons, how do I import them?
I’d appreciate detailed instructions on how to go about it!
Hi @hiroto, there are a few ways how to do this but here is the way I prefer - you can add the material icons as a font to weweb.
Go to the Google Icons Github page: material-design-icons/font at master · google/material-design-icons · GitHub.
Download the font files - these are the ones with the .ttf and .otf extensions.
In your weweb project, go to your Design System and select Fonts.
Now you have the font loaded and you can use the icons in your weweb project. Here is how:
Paste that text into your project, into the text element.
And there you go - as long as the text element is your custom Google Font, it will display the Google icon.
Yes I know, it is quite a few steps - but once you have the icons set up as font in your application it is just a question of copy and paste the icon name into your project as a text element. And you can style those icons like any text so it is very powerful.
Here’s a short video by @visualdevs showing how to import icons in WeWeb.
Thanks all! Just adding that now you can import the Google Material Symbols via the google fonts API, so you no longer need to download the files and upload them to WeWeb. Super quick and easy.
Jack
Can you use those icons for button left/right icons?
Has anyone figured out how to swap the Google Material Symbols from an unfilled state to a filled state dynamically?
There’s a handful of references on how to do it with traditional code (here and here), but unsure the best way to implement it in WeWeb.
Primary use case: symbol (which I have configured as a text element with the Google Material Symbols font) changes to a filled state on hover.
Thanks!
Jack
Mmm I haven’t tried it but probably not because:
There might be a workaround but can’t think of one right now
A question here, If there will be 10 fonts connected (for example using icons from different fonts) are all fonts will be loaded on page each time?
Or if I have few icon fonts connected but Im using just 1 font are other fonts still loaded on page right?
Same if I have added to library 20 google fonts are they all will be loaded?
This question is about speed optimisation.
@Anna.fae To my understanding, the fonts will be loaded on first load page load, then cached.
The screenshot of my network tab with the cache disabled shows the initial download via Google Fonts API is very small anyways. Hope this helps.
Jack
How do you make the icons filled?
Personally , I just use phosphor icon script in the header , when I want to add a new icon I just use the naming like « ph icon- name » as a replacement of an basic icon.
Might not be still the best way now but I kept doing it
Uploading at the time seemed to me too heavy since I use only a few icons
Works like a charms and need just a one time code snippet script to add to a header project
And look for the icon I want in phosphor site
That script inject 6 css files. All of them are around 538kB before compression.
You can also load directly only the css of the style you use.