1 | <p align="center">
|
2 | <a href="https://uiwjs.github.io/icons">
|
3 | <img width="150" src="https://raw.githubusercontent.com/uiwjs/icons/master/assets/logo.svg?sanitize=true">
|
4 | </a>
|
5 | </p>
|
6 |
|
7 |
|
8 | uiw-icons
|
9 | ---
|
10 |
|
11 |
|
12 | [![](https://img.shields.io/github/issues/uiwjs/icons.svg)](https://github.com/uiwjs/icons/issues) [![](https://img.shields.io/github/forks/uiwjs/icons.svg)](https://github.com/uiwjs/icons/network) [![](https://img.shields.io/github/stars/uiwjs/icons.svg)](https://github.com/uiwjs/icons/stargazers) [![](https://img.shields.io/github/release/uiwjs/icons.svg)](https://github.com/uiwjs/icons/releases) [![Packagist](https://img.shields.io/dub/l/vibe-d.svg)](https://github.com/uiwjs/icons) [![Packagist](https://img.shields.io/npm/v/@uiw/icons.svg)](https://www.npmjs.com/package/@uiw/icons)
|
13 |
|
14 | The premium icon font for [uiwjs](https://github.com/uiwjs) Component Library. Designed by [@liwen0526](https://github.com/liwen0526).
|
15 |
|
16 | Visit **[https://uiwjs.github.io/icons/](https://uiwjs.github.io/icons/)** and check out the search feature, which has keywords identifying common icon names and styles. For example, if you search for "arrow" we call up every icon that could possibly be used as an arrow. We've also included each icon's class name for easy copy / pasting when you're developing!
|
17 |
|
18 | They are free to use and licensed under [MIT](https://opensource.org/licenses/MIT). We intend for this icon pack to be used with [uiw](https://uiwjs.github.io), but it’s by no means limited to it. Use them wherever you see fit, personal or commercial.
|
19 |
|
20 | <p align="center">
|
21 | <a href="https://uiwjs.github.io/icons">
|
22 | <img src="https://github.com/uiwjs/icons/raw/master/assets/uiw-font.png">
|
23 | </a>
|
24 | </p>
|
25 |
|
26 | ## Installation
|
27 |
|
28 | ```bash
|
29 | # v1.x +
|
30 | npm install uiw-iconfont --save
|
31 | # v2.x
|
32 | npm install @uiw/icons --save
|
33 | ```
|
34 |
|
35 | ## HTML Example
|
36 |
|
37 | You can use [https://uiwjs.github.io/icons/](https://uiwjs.github.io/icons/) to easily find the icon you want to use. Once you've copied the desired icon's CSS classname, simply add the icon and icon's classname, such as `apple` to an HTML element.
|
38 |
|
39 | You need link CSS
|
40 |
|
41 | ```html
|
42 | <link rel="stylesheet" type="text/css" href="node_modules/@uiw/icons/w-icon.css">
|
43 | ```
|
44 |
|
45 | **Used in Less:**
|
46 |
|
47 | ```css
|
48 | @import "~@uiw/icons/fonts/w-icon.css";
|
49 | ```
|
50 |
|
51 | **Used in JS:**
|
52 |
|
53 | ```js
|
54 | import '@uiw/icons/fonts/w-icon.css';
|
55 | // or
|
56 | import '@uiw/icons/fonts/w-icon.less';
|
57 | ```
|
58 |
|
59 | note: It has a `w-icon-` prefix.
|
60 |
|
61 | ```html
|
62 | <i class="w-icon-apple"></i>
|
63 | ```
|
64 |
|
65 | Or use the `Unicode`, You can use [Unicode website](https://uiwjs.github.io/icons/unicode.html) to easily find the `Unicode` icon you want to use.
|
66 |
|
67 | ```html
|
68 | <style>
|
69 | .iconfont{
|
70 | font-family: "w-icon" !important;
|
71 | font-size: 16px;
|
72 | font-style: normal;
|
73 | -webkit-font-smoothing: antialiased;
|
74 | -webkit-text-stroke-width: 0.2px;
|
75 | -moz-osx-font-smoothing: grayscale;
|
76 | }
|
77 | </style>
|
78 | <span class="iconfont"></span>
|
79 | ```
|
80 |
|
81 | Or manually download and link `**@uiw/icons**` in your HTML, It can also be downloaded via [UNPKG](https://unpkg.com/@uiw/icons/):
|
82 |
|
83 | ```html
|
84 | <link rel="stylesheet" type="text/css" href="https://unpkg.com/@uiw/icons/fonts/w-icon.css">
|
85 | <span class="w-icon-adobe"></span>
|
86 | ```
|
87 |
|
88 | **In Webpack**
|
89 |
|
90 | ```js
|
91 | {
|
92 | test: /w-icon\.(eot|ttf|svg)$/,
|
93 | use: [
|
94 | {
|
95 | loader: require.resolve('url-loader'),
|
96 | options: { limit: 8192 }
|
97 | },
|
98 | {
|
99 | loader: require.resolve('file-loader'),
|
100 | options: {
|
101 | name: 'static/fonts/[name].[hash:8].[ext]',
|
102 | }
|
103 | }
|
104 | ]
|
105 | },
|
106 | ```
|
107 |
|
108 | ## React
|
109 |
|
110 | Create an `Icon` component.
|
111 |
|
112 | ```jsx
|
113 | import React from 'react';
|
114 | import svgPaths from '@uiw/icons/fonts/w-icon.json';
|
115 |
|
116 | const renderSvgPaths = (type) => {
|
117 | const pathStrings = svgPaths[type];
|
118 | if (pathStrings == null) {
|
119 | return null
|
120 | }
|
121 | return pathStrings.map((d, i) => <path key={i} d={d} fillRule="evenodd" />)
|
122 | }
|
123 |
|
124 | export default class Icon extends React.PureComponent {
|
125 | render() {
|
126 | const { type, color } = this.props;
|
127 | if (type == null || typeof type === "boolean") {
|
128 | return null;
|
129 | }
|
130 | return (
|
131 | <svg fill={color} viewBox={`0 0 24 24`}>{this.renderSvgPaths(type)}</svg>
|
132 | );
|
133 | }
|
134 | }
|
135 | ```
|
136 |
|
137 | Use the `Icon` component:
|
138 |
|
139 | ```jsx
|
140 | const demo = () => {
|
141 | return (
|
142 | <Icon type="heart-on" />
|
143 | )
|
144 | }
|
145 | ```
|
146 |
|
147 |
|
148 | ## Development
|
149 |
|
150 | Run the `npm install` to install the dependencies after cloning the project and you'll be able to:
|
151 |
|
152 | To build `*.svg` `*.ttf` `*.woff` `*.eot` files
|
153 |
|
154 | ```bash
|
155 | npm run font
|
156 | ```
|
157 |
|
158 | To build site and push gh-pages branch
|
159 |
|
160 | ```bash
|
161 | npm run start
|
162 | ```
|
163 |
|
164 | ## License
|
165 |
|
166 | Created By [svgtofont](https://github.com/jaywcjlove/svgtofont), Licensed under the [MIT License](https://opensource.org/licenses/MIT). |
\ | No newline at end of file |