Skip to content

Commit 18c962d

Browse files
committed
docs: update icons documentation
1 parent 51cf9a9 commit 18c962d

File tree

4 files changed

+158
-21
lines changed

4 files changed

+158
-21
lines changed

packages/docs/.vuepress/client.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineClientConfig } from '@vuepress/client'
22

3-
import { CIcon } from '@coreui/icons-vue'
3+
import { CIcon, CIconSvg } from '@coreui/icons-vue'
44
import CChartPlugin from '@coreui/vue-chartjs'
55
import CoreuiVue from '@coreui/vue/src/'
66
import '@coreui/coreui/scss/coreui.scss'
@@ -71,6 +71,7 @@ export default defineClientConfig({
7171
app.use(CoreuiVue)
7272
app.provide('icons', icons)
7373
app.component('CIcon', CIcon)
74+
app.component('CIconSvg', CIconSvg)
7475
app.use(CChartPlugin),
7576
router.addRoute({ path: '', redirect: '/getting-started/introduction.html' })
7677
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### CIconSvg
2+
3+
```jsx
4+
import { CIconSvg } from '@coreui/icons-vue'
5+
// or
6+
import CIconSvg from '@coreui/icons-vue/src/CIconSvg'
7+
```
8+
9+
#### Props
10+
11+
| Prop name | Description | Type | Values | Default |
12+
| --------------------- | ------------------------------------------------------------------------------------------------- | --------------------- | ------ | ------- |
13+
| **custom-class-name** | Use for replacing default CIconSvg component classes. Prop is overriding the 'size' prop. | string\|array\|object | - | - |
14+
| **height** | The height attribute defines the vertical length of an icon. | number | - | - |
15+
| **size** | Size of the icon. Available sizes: 'sm', 'lg', 'xl', 'xxl', '3xl...9xl', 'custom', 'custom-size'. | string | - | - |
16+
| **title** | Title tag content. | string | - | - |
17+
| **width** | The width attribute defines the horizontal length of an icon. | number | - | - |

packages/docs/components/icon.md

+138-19
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: Vue Icon Component
33
name: Icon
4-
description: Official Vue.js component for CoreUI Icons and CoreUI Icons PRO.
4+
description: Vue icons library is a great resource for Vue developers, who can use its customizable SVG icons in their applications. It offers an extensive library of icons to choose from, which can be easily inserted into projects with just a few lines of code. Not only that, but users are also able to customize the appearance of these icons by setting various props on them. This provides developers with an efficient and flexible way to integrate useful graphical elements into their web pages without doing any extra work.
55
---
66

77
## Installation
88

9-
If you want to use our icon component and our icons library you have to install two additional packages.
9+
To start using CoreUI Vue Icons in your project, you need to install it as a dependency. Follow the instructions below based on your package manager of choice:
1010

1111
### Npm
1212

@@ -27,7 +27,11 @@ yarn add @coreui/icons-vue
2727

2828
## Usage
2929

30-
### Single icon
30+
Import vue.js icons using one of these two options:
31+
32+
### Single Vue.js icon
33+
34+
To use a single Vue.js icon, import the `<CIcon>` component and the desired icon(s) from the `@coreui/icons` library. Then, include the `<CIcon>` component in your code and specify the icon prop with the imported icon variable. Additionally, you can set the desired size for the icon using the `size` prop.
3135

3236
::: demo
3337
<CIcon :icon="icon.cilList" size="xl"/>
@@ -57,6 +61,8 @@ export default {
5761

5862
### All icons
5963

64+
To use all icons available in the CoreUI Vue.js Icons package, import the CIcon component and the entire `@coreui/icons` library using the `* as` syntax. Then, reference the desired icon within the `icon` prop.
65+
6066
```vue
6167
<template>
6268
<CIcon :icon="icon.cilList" size="xxl"/>
@@ -76,10 +82,9 @@ export default {
7682
}
7783
</script>
7884
```
79-
8085
### Icons object
8186

82-
This way you import your needed icons once and pass them to $root object on 'icons' key
87+
This way you import your needed Vue.js icons once and pass them to $root object on 'icons' key
8388

8489
```js
8590
// main.js / main.ts
@@ -114,13 +119,139 @@ app.component('CIcon', CIcon)
114119
app.mount('#app')
115120

116121
```
122+
117123
Later anywhere in the app:
124+
118125
```vue
119126
<CIcon icon="cilArrowBottom" size="xxl"/>
120127
<CIcon icon="cil-arrow-bottom" size="xxl"/>
121128
```
129+
122130
You can pass the name of the icon both in camelCase and kebab-case
123131

132+
### Color
133+
134+
The CoreUI Vue Icon component offers versatile color customization options, empowering you to personalize the icons in multiple ways. You can effortlessly modify the colors by utilizing either class names or CSS variables, providing flexibility and ease in creating visually stunning and cohesive icon designs.
135+
136+
#### Utility classes
137+
138+
With some [color utility classes](https://coreui.io/docs/utilities/colors/), you may use color to convey message.
139+
140+
::: demo
141+
<CIcon :icon="icon.cilList" size="xl" />
142+
<CIcon :icon="icon.cilList" class="text-primary" size="xl" />
143+
<CIcon :icon="icon.cilList" class="text-secondary" size="xl" />
144+
<CIcon :icon="icon.cilList" class="text-success" size="xl" />
145+
<CIcon :icon="icon.cilList" class="text-danger" size="xl" />
146+
<CIcon :icon="icon.cilList" class="text-warning" size="xl" />
147+
<CIcon :icon="icon.cilList" class="text-info" size="xl" />
148+
:::
149+
```vue
150+
::: demo
151+
<CIcon :icon="cilList" size="xl" />
152+
<CIcon :icon="cilList" class="text-primary" size="xl" />
153+
<CIcon :icon="cilList" class="text-secondary" size="xl" />
154+
<CIcon :icon="cilList" class="text-success" size="xl" />
155+
<CIcon :icon="cilList" class="text-danger" size="xl" />
156+
<CIcon :icon="cilList" class="text-warning" size="xl" />
157+
<CIcon :icon="cilList" class="text-info" size="xl" />
158+
:::
159+
```
160+
161+
#### CSS Variables
162+
163+
CoreUI Vue Icons leverage local CSS variables, such as `--ci-primary-color` and `--ci-secondary-color` (for Duotone icons), to facilitate real-time customization. This allows developers to easily customize the icons by providing their own custom CSS variables.
164+
165+
::: demo
166+
<CIcon :icon="icon.cilList" size="xl" :style="{'--ci-primary-color': 'red'}" />
167+
<CIcon :icon="icon.cilList" size="xl" :style="{'--ci-primary-color': 'green'}" />
168+
:::
169+
```vue
170+
<CIcon :icon="cilList" size="xl" :style="{'--ci-primary-color': 'red'}" />
171+
<CIcon :icon="cilList" size="xl" :style="{'--ci-primary-color': 'green'}" />
172+
```
173+
174+
### Sizing
175+
176+
Set heights of vue icons using size property like `size="lg"` and `size="sm"`.
177+
178+
::: demo
179+
<CIcon :icon="icon.cilList" size="sm" />
180+
<CIcon :icon="icon.cilList" />
181+
<CIcon :icon="icon.cilList" size="lg" />
182+
<CIcon :icon="icon.cilList" size="xl" />
183+
<CIcon :icon="icon.cilList" size="xxl" />
184+
<CIcon :icon="icon.cilList" size="3xl" />
185+
:::
186+
```vue
187+
<CIcon :icon="cilList" size="sm" />
188+
<CIcon :icon="cilList" />
189+
<CIcon :icon="cilList" size="lg" />
190+
<CIcon :icon="cilList" size="xl" />
191+
<CIcon :icon="cilList" size="xxl" />
192+
<CIcon :icon="cilList" size="3xl" />
193+
```
194+
195+
### Custom SVG Icons
196+
197+
The `<CIconSvg`> component allows you to add custom SVG icons to your application. In case you want to use custom SVG icons, this component provides the flexibility to include bespoke SVG graphics that align with your design requirements.
198+
199+
::: demo
200+
<CIconSvg size="4xl">
201+
<svg
202+
viewBox="0 0 102 116"
203+
version="1.1"
204+
xmlns="http://www.w3.org/2000/svg"
205+
xmlnsXlink="http://www.w3.org/1999/xlink"
206+
>
207+
<g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
208+
<g fill="#3C4B64" fillRule="nonzero">
209+
<path
210+
d="M96,25.091 L57,2.5743 C53.2871871,0.430706461 48.7128129,0.430706461 45,2.5743 L6,25.091 C2.292246,27.239646 0.00690676667,31.1979678 0,35.4833 L0,80.5167 C0.00688629146,84.8020377 2.29223099,88.760369 6,90.909 L45,113.4256 C48.7127742,115.569338 53.2872258,115.569338 57,113.4256 L96,90.909 C99.707769,88.760369 101.993114,84.8020377 102,80.5167 L102,35.4833 C101.993093,31.1979678 99.707754,27.239646 96,25.091 Z M94,80.5167 C94,81.9457261 93.2375729,83.266187 92,83.9807 L53,106.4974 C51.7623957,107.211931 50.2376043,107.211931 49,106.4974 L10,83.9807 C8.76242713,83.266187 8,81.9457261 8,80.5167 L8,35.4833 C8,34.0542382 8.76239619,32.7337309 10,32.0192 L49,9.5025 C50.2376043,8.78796882 51.7623957,8.78796882 53,9.5025 L92,32.0192 C93.2376038,32.7337309 94,34.0542382 94,35.4833 L94,80.5167 Z"
211+
id="Shape"
212+
/>
213+
<path
214+
d="M74.0216,71.0379 L71.1556,71.0379 C70.4827717,71.0379163 69.8208181,71.2076524 69.231,71.5314 L51.95,81.0167 L32,69.4981 L32,46.5206 L51.95,35.002 L69.2394,44.457 C69.8278903,44.7788245 70.4878603,44.9474965 71.1586,44.9475 L74.0218,44.9475 C75.1263695,44.9475 76.0218,44.0520695 76.0218,42.9475 L76.0218,40.2357 C76.0218,39.5046907 75.6230914,38.8318844 74.9818,38.481 L55.793,27.9854 C53.3404536,26.651551 50.3714915,26.6856213 47.9502,28.0754 L28,39.5929 C25.5282949,41.025705 24.0048155,43.6646378 24,46.5216 L24,69.4976 C24,72.3557593 25.5247614,74.9968204 28,76.4259 L47.95,87.9444 C50.3719491,89.3331078 53.3408366,89.3663802 55.7933,88.0323 L74.9833,77.5012 C75.623333,77.1499602 76.021125,76.4778764 76.0211,75.7478 L76.0211,73.0378 C76.0210448,71.9334648 75.1259352,71.0381761 74.0216,71.0379 L74.0216,71.0379 Z"
215+
id="Path"
216+
/>
217+
</g>
218+
</g>
219+
</svg>
220+
</CIconSvg>
221+
:::
222+
```vue
223+
<template>
224+
<CIconSvg size="4xl">
225+
<svg
226+
viewBox="0 0 102 116"
227+
version="1.1"
228+
xmlns="http://www.w3.org/2000/svg"
229+
xmlnsXlink="http://www.w3.org/1999/xlink"
230+
>
231+
<g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
232+
<g fill="#3C4B64" fillRule="nonzero">
233+
<path
234+
d="M96,25.091 L57,2.5743 C53.2871871,0.430706461 48.7128129,0.430706461 45,2.5743 L6,25.091 C2.292246,27.239646 0.00690676667,31.1979678 0,35.4833 L0,80.5167 C0.00688629146,84.8020377 2.29223099,88.760369 6,90.909 L45,113.4256 C48.7127742,115.569338 53.2872258,115.569338 57,113.4256 L96,90.909 C99.707769,88.760369 101.993114,84.8020377 102,80.5167 L102,35.4833 C101.993093,31.1979678 99.707754,27.239646 96,25.091 Z M94,80.5167 C94,81.9457261 93.2375729,83.266187 92,83.9807 L53,106.4974 C51.7623957,107.211931 50.2376043,107.211931 49,106.4974 L10,83.9807 C8.76242713,83.266187 8,81.9457261 8,80.5167 L8,35.4833 C8,34.0542382 8.76239619,32.7337309 10,32.0192 L49,9.5025 C50.2376043,8.78796882 51.7623957,8.78796882 53,9.5025 L92,32.0192 C93.2376038,32.7337309 94,34.0542382 94,35.4833 L94,80.5167 Z"
235+
id="Shape"
236+
/>
237+
<path
238+
d="M74.0216,71.0379 L71.1556,71.0379 C70.4827717,71.0379163 69.8208181,71.2076524 69.231,71.5314 L51.95,81.0167 L32,69.4981 L32,46.5206 L51.95,35.002 L69.2394,44.457 C69.8278903,44.7788245 70.4878603,44.9474965 71.1586,44.9475 L74.0218,44.9475 C75.1263695,44.9475 76.0218,44.0520695 76.0218,42.9475 L76.0218,40.2357 C76.0218,39.5046907 75.6230914,38.8318844 74.9818,38.481 L55.793,27.9854 C53.3404536,26.651551 50.3714915,26.6856213 47.9502,28.0754 L28,39.5929 C25.5282949,41.025705 24.0048155,43.6646378 24,46.5216 L24,69.4976 C24,72.3557593 25.5247614,74.9968204 28,76.4259 L47.95,87.9444 C50.3719491,89.3331078 53.3408366,89.3663802 55.7933,88.0323 L74.9833,77.5012 C75.623333,77.1499602 76.021125,76.4778764 76.0211,75.7478 L76.0211,73.0378 C76.0210448,71.9334648 75.1259352,71.0381761 74.0216,71.0379 L74.0216,71.0379 Z"
239+
id="Path"
240+
/>
241+
</g>
242+
</g>
243+
</svg>
244+
</CIconSvg>
245+
</template>
246+
<script>
247+
import { CIconSvg } from '@coreui/icons-vue';
248+
export default {
249+
components: {
250+
CIconSvg
251+
}
252+
}
253+
</script>
254+
```
124255

125256
## Available icons
126257

@@ -220,18 +351,6 @@ export default {
220351

221352
## API
222353

223-
### CIcon
224-
225-
```js
226-
import { CIcon } from '@coreui/icons-vue'
227-
```
354+
!!!include(./api/coreui-icons-vue/src/CIcon.api.md)!!!
228355

229-
| Prop name | Description | Type | Values | Default |
230-
| --------------------- | ------------------------------------------------------------------------------------------------- | --------------------- | ------ | ------- |
231-
| **content** | Use `:icon="..."` instead of<br/>`@deprecated` since version 3.0 | string\|array | - | - |
232-
| **custom-class-name** | Use for replacing default CIcon component classes. Prop is overriding the 'size' prop. | string\|array\|object | - | - |
233-
| **icon** | Name of the icon placed in Vue object or SVG content. | string \| string[] | - | - |
234-
| **name** | Use `icon="..."` instead of<br/>`@deprecated` since version 3.0 | string | - | - |
235-
| **size** | Size of the icon. Available sizes: 'sm', 'lg', 'xl', 'xxl', '3xl...9xl', 'custom', 'custom-size'. | string | - | - |
236-
| **title** | Title tag content. | string | - | - |
237-
| **use** | If defined component will be rendered using 'use' tag. | string | - | - |
356+
!!!include(./api/coreui-icons-vue/src/CIconSvg.api.md)!!!

packages/docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@coreui/chartjs": "^4.0.0",
1212
"@coreui/coreui": "^5.1.0",
1313
"@coreui/icons": "^3.0.1",
14-
"@coreui/icons-vue": "^2.0.0",
14+
"@coreui/icons-vue": "^2.1.0",
1515
"@coreui/utils": "^2.0.2",
1616
"@coreui/vue-chartjs": "^3.0.0",
1717
"@docsearch/css": "^3.6.1",

0 commit comments

Comments
 (0)