ayoub 079702df17 Auto COMMIT for build : 7383 \n commit by: a.hassani <hassani.ayoub@gmail.com> \n with message : add all icons | 9 months ago | |
---|---|---|
ai | 9 months ago | |
bi | 9 months ago | |
bs | 9 months ago | |
cg | 9 months ago | |
ci | 9 months ago | |
fa | 9 months ago | |
fa6 | 9 months ago | |
fc | 9 months ago | |
fi | 9 months ago | |
gi | 9 months ago | |
go | 9 months ago | |
gr | 9 months ago | |
hi | 9 months ago | |
hi2 | 9 months ago | |
im | 9 months ago | |
io | 9 months ago | |
io5 | 9 months ago | |
lia | 9 months ago | |
lib | 9 months ago | |
lu | 9 months ago | |
md | 9 months ago | |
pi | 9 months ago | |
ri | 9 months ago | |
rx | 9 months ago | |
si | 9 months ago | |
sl | 9 months ago | |
tb | 9 months ago | |
tfi | 9 months ago | |
ti | 9 months ago | |
vsc | 9 months ago | |
wi | 9 months ago | |
LICENSE | 9 months ago | |
README.md | 9 months ago | |
index.d.ts | 9 months ago | |
index.js | 9 months ago | |
index.mjs | 9 months ago | |
package.json | 9 months ago |
Include popular icons in your React projects easily with @d3v4pp/svgs
, which utilizes ES6 imports that allows you to include only the icons that your project is using.
yarn add @d3v4pp/svgs
# or
npm install @d3v4pp/svgs --save
example usage
import { FaBeer } from "@d3v4pp/svgs/fa";
function Question() {
return (
<h3>
Lets go for a <FaBeer />?
</h3>
);
}
View the documentation for further usage examples and how to use icons from other packages. NOTE: each Icon package has it's own subfolder under @d3v4pp/svgs
you import from.
For example, to use an icon from Material Design, your import would be: import { ICON_NAME } from '@d3v4pp/svgs/md';
Note This option has not had a new release for some time. More info https://github.com/@d3v4pp/svgs/@d3v4pp/svgs/issues/593
If your project grows in size, this option is available. This method has the trade-off that it takes a long time to install the package.
yarn add @@d3v4pp/svgs
# or
npm install @@d3v4pp/svgs --save
example usage
import { FaBeer } from "@@d3v4pp/svgs/fa";
function Question() {
return (
<h3>
Lets go for a <FaBeer />?
</h3>
);
}
You can add more icons by submitting pull requests or creating issues.
You can configure @d3v4pp/svgs props using React Context API.
Requires React 16.3 or higher.
import { IconContext } from "@d3v4pp/svgs";
<IconContext.Provider value={{ color: "blue", className: "global-class-name" }}>
<div>
<FaFolder />
</div>
</IconContext.Provider>;
Key | Default | Notes |
---|---|---|
color |
undefined (inherit) |
|
size |
1em |
|
className |
undefined |
|
style |
undefined |
Can overwrite size and color |
attr |
undefined |
Overwritten by other attributes |
title |
undefined |
Icon description for accessibility |
From version 3, vertical-align: middle
is not automatically given. Please use IconContext to specify className or specify an inline style.
<IconContext.Provider value={{ style: { verticalAlign: 'middle' } }}>
className
StylingComponent
<IconContext.Provider value={{ className: '@d3v4pp/svgs' }}>
Dependencies on @types/@d3v4pp/svgs
can be deleted.
yarn remove @types/@d3v4pp/svgs
npm remove @types/@d3v4pp/svgs
./build-script.sh
will build the whole project. See also CI scripts for more information.
yarn
cd packages/@d3v4pp/svgs
yarn fetch # fetch icon sources
yarn build
SVG is supported by all major browsers. With @d3v4pp/svgs
, you can serve only the needed icons instead of one big font file to the users, helping you to recognize which icons are used in your project.