Skip to content

[pull] main from coreui:main #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
docs: add CIconSvg component documentation
  • Loading branch information
mrholek committed Jul 14, 2024
commit 7fa5ed2cfbed8a51d53ca76d35f5744d16b94cfd
2 changes: 1 addition & 1 deletion packages/coreui-icons-react
15 changes: 15 additions & 0 deletions packages/docs/content/api/CIconSvg.api.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

```jsx
import { CIconSvg } from '@coreui/icons-react'
// or
import CIconSvg from '@coreui/icons-react/src/CIconSvg'
```

| Property | Description | Type | Default |
| --- | --- | --- | --- |
| **className** | A string of all className you want applied to the component. | `string` | - |
| **customClassName** | Use for replacing default CIcon component classes. Prop is overriding the 'size' prop. | `string` \| `string[]` | - |
| **height** | The height attribute defines the vertical length of an icon. | `number` | - |
| **size** | Size of the icon. Available sizes: 'sm', 'lg', 'xl', 'xxl', '3xl...9xl', 'custom', 'custom-size'. | `'custom'` \| `'custom-size'` \| `'sm'` \| `'lg'` \| `'xl'` \| `'xxl'` \| `'3xl'` \| `'4xl'` \| `'5xl'` \| `'6xl'` \| `'7xl'` \| `'8xl'` \| `'9xl'` | - |
| **title** | Title tag content. | `string` | - |
| **width** | The width attribute defines the horizontal length of an icon. | `number` | - |
69 changes: 64 additions & 5 deletions packages/docs/content/components/icon.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
CRow,
CTabContent,
CTabPane } from '@coreui/react/src/index'
import CIcon from '@coreui/icons-react'
import {CIcon, CIconSvg} from '@coreui/icons-react/src/index'
import { cilList, cilShieldAlt } from '@coreui/icons'
import * as icon from '@coreui/icons';

Expand Down Expand Up @@ -44,8 +44,8 @@ Import react icons using one of these two options:
To use a single react 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.

<Example>
<CIcon icon={cilList} size="xl"/>
<CIcon icon={cilShieldAlt} size="xl"/>
<CIcon icon={cilList} size="xl" />
<CIcon icon={cilShieldAlt} size="xl" />
</Example>

```jsx
Expand Down Expand Up @@ -108,13 +108,68 @@ Set heights of react icons using size property like size="lg" and size="sm".

```jsx preview
<CIcon icon={cilList} size="sm" />
<CIcon icon={cilList} size="md" />
<CIcon icon={cilList} />
<CIcon icon={cilList} size="lg" />
<CIcon icon={cilList} size="xl" />
<CIcon icon={cilList} size="xxl" />
<CIcon icon={cilList} size="3xl" />
```

### Custom SVG Icons

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.

<Example>
<CIconSvg size="4xl">
<svg
viewBox="0 0 102 116"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
>
<g stroke="none" strokeWidth={1} fill="none" fillRule="evenodd">
<g fill="#3C4B64" fillRule="nonzero">
<path
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"
id="Shape"
/>
<path
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"
id="Path"
/>
</g>
</g>
</svg>
</CIconSvg>
</Example>

```jsx
import { CIconSvg } from '@coreui/icons-react';

...
<CIconSvg size="4xl">
<svg
viewBox="0 0 102 116"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
>
<g stroke="none" strokeWidth={1} fill="none" fillRule="evenodd">
<g fill="#3C4B64" fillRule="nonzero">
<path
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"
id="Shape"
/>
<path
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"
id="Path"
/>
</g>
</g>
</svg>
</CIconSvg>
...
```

## Accessibility

Expand Down Expand Up @@ -317,4 +372,8 @@ So if you need more icons our PRO package will be a great choice for you.

### CIcon

`markdown:CIcon.api.mdx`
`markdown:CIcon.api.mdx`

### CIconSvg

`markdown:CIconSvg.api.mdx`
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@coreui/chartjs": "^4.0.0",
"@coreui/coreui": "^5.0.2",
"@coreui/icons": "^3.0.1",
"@coreui/icons-react": "^2.2.1",
"@coreui/icons-react": "^2.3.0",
"@coreui/react-chartjs": "^3.0.0",
"@coreui/utils": "^2.0.2",
"@docsearch/css": "^3.6.0",
Expand Down