flag-icons
flag-icons copied to clipboard
does this still function? I've installed with npm using react btw, used the classes just like in description but nothing happens.
I'm using it like this: <span className="fi fi-gr"></span>
Don't forget to import the css file as well. e.g. import "/node_modules/flag-icons/css/flag-icons.min.css";
I have similiar issues using flag-icons in an angular-context.
After running npm i --include=dev flag-icons I tried the following:
in Angular.json I had put the path in the styles section.
"styles": [ "./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css", "./node_modules/flag-icons/css/flag-icons.min.css", "src/styles.scss" ],
Trying to get a flag visible with this, not working.
<span class="fi fi-in"></span>
Tried @import "./node_modules/flag-icons/css/flag-icons.min.css";
in my styles.scss. Tried the same in the .scss related to a specific component where I want the flags to show up. Any ideas?
You also need to add a width and height on the icon. You also need to make sure that the parent has a display: flex. In my case, these two points was the missing CSS attribute that prevented the icon to show...
I'm not familiar with angular.. but maybe it's better to use the https://github.com/lipis/flag-icons/tree/main/sass instead? You'll need to include the flags folder and point to it via https://github.com/lipis/flag-icons/blob/main/sass/_variables.scss#L1
@m0wglii I'm Angular dev here, no problem using the library so far. The only thing I did was importing the minified CSS file into the angular.json
file:
"styles": [
"node_modules/flag-icons/css/flag-icons.min.css",
"src/styles.scss"
],
Restart the compiler and <span class="fi fi-eu"></span>
should work.
I didn't try anymore, I will close this issue.