|
1 |
| -### [@coreui/icons-react](https://coreui.io/) for [CoreUI for React](https://coreui.io/react/) |
| 1 | +<p align="center"> |
| 2 | + <a href="https://coreui.io/"> |
| 3 | + <img src="https://coreui.io/images/brand/coreui-icons.svg" alt="CoreUI Icons logo" height="50"> |
| 4 | + </a> |
| 5 | +</p> |
2 | 6 |
|
| 7 | +<p align="center"> |
| 8 | + Official React.js component for CoreUI Icons and CoreUI Icons PRO. |
| 9 | + <br> |
| 10 | + <a href="https://coreui.io/react/docs/components/icon/"><strong>Explore CoreUI Icons for React docs »</strong></a> |
| 11 | + <br> |
| 12 | + <br> |
| 13 | + <a href="https://github.com/coreui/coreui-icons/issues/new?template=bug_report.md">Report bug</a> |
| 14 | + · |
| 15 | + <a href="https://github.com/coreui/coreui-icons/issues/new?template=feature_request.md">Request feature</a> |
| 16 | + · |
| 17 | + <a href="https://blog.coreui.io/">Blog</a> |
| 18 | +</p> |
| 19 | + |
| 20 | + |
| 21 | +## Status |
3 | 22 | [![npm package][npm-badge]][npm]
|
4 | 23 | [![NPM downloads][npm-download]][npm]
|
5 |
| - |
| 24 | + |
6 | 25 |
|
7 | 26 |
|
8 | 27 | [npm-badge]: https://img.shields.io/npm/v/@coreui/icons-react/latest?style=flat-square
|
9 | 28 | [npm]: https://www.npmjs.com/package/@coreui/icons-react
|
10 | 29 | [npm-download]: https://img.shields.io/npm/dm/@coreui/icons-react.svg?style=flat-square
|
11 | 30 |
|
12 |
| -##### docs: |
13 |
| -- https://coreui.io/react/docs/components/CIcon |
14 |
| -- https://icons.coreui.io/docs/using-coreui-icons-with/react/ |
| 31 | +## Installation |
15 | 32 |
|
16 |
| -##### install: |
17 | 33 | ```bash
|
18 | 34 | npm install @coreui/icons
|
19 | 35 | npm install @coreui/icons-react
|
20 | 36 | ```
|
21 | 37 |
|
22 |
| -##### import: |
| 38 | +or |
| 39 | + |
| 40 | +```bash |
| 41 | +yarn add @coreui/icons |
| 42 | +yarn add @coreui/icons-react |
| 43 | +``` |
| 44 | + |
| 45 | +## Use |
| 46 | + |
| 47 | +### Single icon |
| 48 | + |
23 | 49 | ```jsx
|
24 | 50 | import { CIcon } from '@coreui/icons-react';
|
25 | 51 | import { cifAU } from '@coreui/icons';
|
26 |
| -``` |
27 |
| -or: |
28 |
| -```scss |
29 |
| -@import '~@coreui/icons/css/all.css'; |
30 |
| -``` |
31 | 52 |
|
32 |
| -##### usage: |
33 |
| -```jsx |
34 |
| -... |
35 |
| -class CoreUIIcons extends Component { |
36 | 53 | ...
|
37 | 54 | render() {
|
38 |
| - return ( |
39 |
| - <CIcon name="cil-list" size="2xl"/> |
40 |
| - ) |
| 55 | + return ( |
| 56 | + <CIcon icon={cilList} size="xxl"/> |
| 57 | + ) |
41 | 58 | }
|
42 | 59 | ...
|
43 | 60 | ```
|
44 | 61 |
|
45 |
| ---- |
| 62 | +### All icons |
46 | 63 |
|
47 |
| -- bootstrapped with [nwb](https://github.com/insin/nwb) toolkit |
| 64 | +```jsx |
| 65 | +import { CIcon } from '@coreui/icons-react'; |
| 66 | +import * as icon from '@coreui/icons'; |
48 | 67 |
|
49 |
| -##### `npm run` scripts |
| 68 | +... |
| 69 | +render() { |
| 70 | + return ( |
| 71 | + <CIcon icon={icon.cilList} size="xxl"/> |
| 72 | + ) |
| 73 | +} |
| 74 | +... |
| 75 | +``` |
50 | 76 |
|
51 |
| -`package.json` is configured with `"scripts"` we can use with `npm run` while developing the project. |
52 | 77 |
|
53 |
| -Command | Description | |
54 |
| ---- | --- |
55 |
| -`npm run build` | prepare for publishing to npm |
56 |
| -`npm run clean` | delete built resources |
57 |
| -`npm test` | run tests |
58 |
| -`npm run test:coverage` | run tests and produce a code coverage report in `coverage/` |
59 |
| -<del>`npm run test:watch`</del> | n/a ~~start a test server and re-run tests on every change~~ |
60 |
| -<del>`npm start`</del> | n/a ~~start a development server for the demo app~~ |
| 78 | +## API |
61 | 79 |
|
62 |
| -#### see also: |
63 |
| -- [Developing React Components and Libraries with nwb](https://github.com/insin/nwb/blob/master/docs/guides/ReactComponents.md#developing-react-components-and-libraries-with-nwb) |
| 80 | +| property | type | description | |
| 81 | +| --- | --- | --- | |
| 82 | +| className | `string` | A string of all className you want applied to the component. | |
| 83 | +| customClassName | `string` \| `object` \| `string[]` | Use for replacing default CIcon component classes. Prop is overriding the 'size' prop. | |
| 84 | +| icon | `string` \| `string[]` | Name of the icon placed in React object or SVG content. | |
| 85 | +| height | `number` | The height attribute defines the vertical length of an icon. | |
| 86 | +| size | `sm` \| `md` \|`lg` \| `xl` \| `xxl` \| `3xl` \| `4xl` \| `5xl` \| `6xl` \| `7xl` \| `8xl` \| `9xl` | Size of the icon. | |
| 87 | +| use | `string` | If defined component will be rendered using `use` tag. | |
| 88 | +| title | `string` | Title tag content. | |
| 89 | +| width | `number` | The width attribute defines the horizontal length of an icon. | |
0 commit comments