|
| 1 | +<p align="center"> |
| 2 | + <a href="https://coreui.io/"> |
| 3 | + <img |
| 4 | + src="https://coreui.io/images/brand/coreui-signet.svg" |
| 5 | + alt="CoreUI logo" |
| 6 | + width="200" |
| 7 | + /> |
| 8 | + </a> |
| 9 | +</p> |
| 10 | + |
| 11 | +<h3 align="center">CoreUI Icons for Angular</h3> |
| 12 | + |
| 13 | +<p align="center"> |
| 14 | + <br> |
| 15 | + <a href="https://coreui.io/angular/docs/icons"><strong>Explore CoreUI for Angular docs »</strong></a> |
| 16 | + <br> |
| 17 | + <br> |
| 18 | + <a href="https://icons.coreui.io/"><strong>CoreUI Icons »</strong></a> |
| 19 | + <br> |
| 20 | + <br> |
| 21 | + <a href="https://github.com/coreui/coreui-icons-angular/issues/new?template=bug_report.md">Report a bug</a> |
| 22 | + · |
| 23 | + <a href="https://github.com/coreui/coreui-icons-angular/issues/new?template=feature_request.md">Request a feature</a> |
| 24 | + · |
| 25 | + <a href="https://blog.coreui.io/">Blog</a> |
| 26 | +</p> |
| 27 | + |
| 28 | +# CoreUI Icons Angular |
| 29 | + |
| 30 | +![angular][angular-badge] |
| 31 | +[][coreui-angular-icons-npm] |
| 32 | +[![npm-coreui-angular-next][npm-coreui-icons-angular-next]][coreui-angular-icons-npm] |
| 33 | +[][coreui-angular-icons-npm] |
| 34 | +[][coreui] |
| 35 | + |
| 36 | +[coreui]: https://coreui.io/icons |
| 37 | +[coreui-angular-icons-npm]: https://www.npmjs.com/package/@coreui/icons-angular |
| 38 | +[npm-coreui-icons-angular-next]: https://img.shields.io/npm/v/@coreui/icons-angular/next.png?style=flat-square&color=red |
| 39 | +[angular-badge]: https://img.shields.io/badge/angular-^14.0.0-lightgrey.svg?style=flat-square&logo=angular |
| 40 | + |
| 41 | +## `cIcon` directive |
| 42 | + |
| 43 | +Angular directive for [CoreUI Icons SVG set](https://coreui.io/icons/). |
| 44 | + |
| 45 | +### Features |
| 46 | + |
| 47 | +- Load icons: |
| 48 | + - stored in Angular root service, |
| 49 | + - directly passed SVG content, |
| 50 | +- Reduce icons bundle size when imported as single icons, |
| 51 | +- Full functionality of `<svg>` tag, |
| 52 | +- Clean API |
| 53 | + |
| 54 | +For directive description visit [https://coreui.io/angular/docs/](https://coreui.io/angular/docs/4.0/) |
| 55 | + |
| 56 | +### Installation |
| 57 | + |
| 58 | +```shell |
| 59 | +npm install @coreui/icons |
| 60 | +npm install @coreui/icons-angular |
| 61 | +``` |
| 62 | + |
| 63 | +### Usage |
| 64 | + |
| 65 | +```ts |
| 66 | +// app NgModule |
| 67 | + |
| 68 | +import { IconModule, IconSetService } from '@coreui/icons-angular'; |
| 69 | + |
| 70 | +@NgModule({ |
| 71 | + imports: [ |
| 72 | + IconModule, |
| 73 | +... |
| 74 | + providers: [IconSetService], |
| 75 | +... |
| 76 | +``` |
| 77 | +
|
| 78 | +```ts |
| 79 | +// app component |
| 80 | + |
| 81 | +import { cilEnvelopeOpen, flagSet } from '@coreui/icons'; |
| 82 | +import { IconSetService } from '@coreui/icons-angular'; |
| 83 | + |
| 84 | +@Component({ |
| 85 | + ... |
| 86 | +}) |
| 87 | +export class AppComponent implements OnInit { |
| 88 | + constructor(public iconSet: IconSetService) { |
| 89 | + // iconSet singleton |
| 90 | + iconSet.icons = { cilEnvelopeOpen, ...flagSet }; |
| 91 | + } |
| 92 | +... |
| 93 | +``` |
| 94 | +
|
| 95 | +```jsx |
| 96 | +<svg cIcon name="cil-envelope-open" size="lg"></svg> |
| 97 | +<svg cIcon name="cifAu"></svg> |
| 98 | +``` |
| 99 | +
|
| 100 | +### API |
| 101 | +
|
| 102 | +#### Icon _directive_ |
| 103 | +> Use one of `name` or `content` prop as it defines the way of icon import |
| 104 | +
|
| 105 | +##### Inputs |
| 106 | +
|
| 107 | +proprerty | type | default | description |
| 108 | +---|---|---|--- |
| 109 | +`name` | string | undefined | name of SVG icon stored in IconSetService |
| 110 | +`content` | string, string[] | undefined | SVG content |
| 111 | +`size` | `custom`, `custom-size`, `sm`, `lg`, `xl`, `xxl`, `3xl`, `4xl`, `5xl`, `6xl`, `7xl`, `8xl`, `9xl` | '' | Size of icon |
| 112 | +`title` | string | undefined | |
| 113 | +`customClasses` | string | undefined | Overwrites default `.icon` classes |
| 114 | +`viewBox` | string | undefined | SVG `viewbox` |
| 115 | +`width` | string | undefined | SVG `width` |
| 116 | +`height` | string | undefined | SVG `height` |
| 117 | +
|
| 118 | +--- |
| 119 | +
|
| 120 | +#### IconSet _service_ |
| 121 | +
|
| 122 | +##### Props |
| 123 | +
|
| 124 | +| proprerty | type | default | description| |
| 125 | +| --- | --- | --- | --- | |
| 126 | +| `getIcon()` | `(string): any[] ` | | returns an icon | |
| 127 | +| `icons` | `IIconSet` | undefined | IconSet object | |
| 128 | +| `iconNames` | `[key: string]: string` | _undefined_ | returns icon name from key | |
| 129 | +
|
| 130 | +--- |
| 131 | +
|
| 132 | +## Support CoreUI Development |
| 133 | +
|
| 134 | +CoreUI is an MIT-licensed open source project and is completely free to use. However, the amount of effort needed to maintain and develop new features for the project is not sustainable without proper financial backing. You can support development by buying the [CoreUI PRO](https://coreui.io/pricing/) or by becoming a sponsor via [Open Collective](https://opencollective.com/coreui/). |
| 135 | +
|
| 136 | +<!--- StartOpenCollectiveBackers --> |
| 137 | +
|
| 138 | +### Platinum Sponsors |
| 139 | +
|
| 140 | +Support this project by [becoming a Platinum Sponsor](https://opencollective.com/coreui/contribute/platinum-sponsor-40959/). A large company logo will be added here with a link to your website. |
| 141 | +
|
| 142 | +<a href="https://opencollective.com/coreui/contribute/platinum-sponsor-40959/checkout"><img src="https://opencollective.com/coreui/tiers/platinum-sponsor/0/avatar.svg?avatarHeight=100"></a> |
| 143 | +
|
| 144 | +### Gold Sponsors |
| 145 | +
|
| 146 | +Support this project by [becoming a Gold Sponsor](https://opencollective.com/coreui/contribute/gold-sponsor-40960/). A big company logo will be added here with a link to your website. |
| 147 | +
|
| 148 | +<a href="https://opencollective.com/coreui/contribute/gold-sponsor-40960/checkout"><img src="https://opencollective.com/coreui/tiers/gold-sponsor/0/avatar.svg?avatarHeight=100"></a> |
| 149 | +
|
| 150 | +### Silver Sponsors |
| 151 | +
|
| 152 | +Support this project by [becoming a Silver Sponsor](https://opencollective.com/coreui/contribute/silver-sponsor-40967/). A medium company logo will be added here with a link to your website. |
| 153 | +
|
| 154 | +<a href="https://opencollective.com/coreui/contribute/silver-sponsor-40967/checkout"><img src="https://opencollective.com/coreui/tiers/gold-sponsor/0/avatar.svg?avatarHeight=100"></a> |
| 155 | +
|
| 156 | +### Bronze Sponsors |
| 157 | +
|
| 158 | +Support this project by [becoming a Bronze Sponsor](https://opencollective.com/coreui/contribute/bronze-sponsor-40966/). The company avatar will show up here with a link to your OpenCollective Profile. |
| 159 | +
|
| 160 | +<a href="https://opencollective.com/coreui/contribute/bronze-sponsor-40966/checkout"><img src="https://opencollective.com/coreui/tiers/bronze-sponsor/0/avatar.svg?avatarHeight=100"></a> |
| 161 | +
|
| 162 | +### Backers |
| 163 | +
|
| 164 | +Thanks to all the backers and sponsors! Support this project by [becoming a backer](https://opencollective.com/coreui/contribute/backer-40965/). |
| 165 | +
|
| 166 | +<a href="https://opencollective.com/coreui/contribute/backer-40965/checkout" target="_blank" rel="noopener"><img src="https://opencollective.com/coreui/backers.svg?width=890"></a> |
| 167 | +
|
| 168 | +<!--- EndOpenCollectiveBackers --> |
| 169 | +
|
| 170 | +## Copyright and license |
| 171 | +
|
| 172 | +Copyright 2022 creativeLabs Łukasz Holeczek. Code released under the [MIT License](https://github.com/coreui/coreui-angular/blob/main/LICENSE). Docs released under [Creative Commons](https://creativecommons.org/licenses/by/3.0/). |
| 173 | +
|
0 commit comments