@icon-park/svg
Version:
Pure Svg Icons for IconPark
93 lines (75 loc) • 2.4 kB
Markdown
> Pure SVG Icons for IconPark
* Provide more than 2000 icons
* Provide 4 themes:
* outline
* filled
* two-tone
* multi-color
Please visit [IconPark Website](http://iconpark.bytedance.com)
* Copy SVG
* Copy React Icon component
* Copy Vue Icon component
* Download PNG
* Download SVG
```
npm install @icon-park/svg --save
```
Import an icon from `@icon-park/svg` and then call it:
```
import {Home} from '@icon-park/svg';
// examples
const svg = Home({theme: 'outline'});
console.log(svg);
```
You can use the static methods `setConfig` in `@icon-park/svg` to set the default config globally:
```typescript
import {setConfig} from '@icon-park/svg'
setConfig({
theme: 'outline',
size: '1em',
strokeWidth: 4,
strokeLinecap: 'round',
strokeLinejoin: 'round',
outStrokeColor: '#000',
outFillColor: '#2F88FF',
innerStrokeColor: '#FFF',
innerFillColor: '#43CCF8'
})
```
You can use [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) to import icons on demand.
Set config like this:
```json
{
"plugins": [
[
"import",
{
"libraryName": "@icon-park/svg",
"libraryDirectory": "es/icons",
"camel2DashComponentName": false
}
]
]
}
```
If you need to use additional information such as icon name, author, category, label and creation time, you can use the `icons.json` file located in the root directory of each NPM.
| prop | description | type | default | note |
| ---------- | --- | --- | --- | --- |
| theme | Theme of the icons. | 'outline' &
| size | The width/height of the icon | number &
| spin | Rotate icon with animation | boolean | false |
| fill | Colors of theme | string &
| strokeLinecap | the stroke-linecap prop of svg element | 'butt' &
| strokeLinejoin | the stroke-linejoin prop of svg element | 'miter' &
| strokeWidth | the stroke-width prop of svg element | number | 4 |