Icon
Library: @coreui/icons-react
Component used to implement CoreUI svg icons.
Usage
Example
Script
return (
<>
<CIcon size={'sm'} name={'cilSettings'} />
<CIcon name={'cilSettings'} />
<CIcon size={'lg'} name={'cilSettings'} />
<CIcon size={'xl'} name={'cilSettings'} />
<CIcon size={'2xl'} name={'cilSettings'} />
<CIcon size={'3xl'} name={'cilSettings'} />
<CIcon size={'4xl'} name={'cilSettings'} />
<CIcon size={'5xl'} name={'cilSettings'} />
<CIcon size={'6xl'} name={'cilSettings'} />
<CIcon size={'7xl'} name={'cilSettings'} />
<CIcon size={'8xl'} name={'cilSettings'} />
<CIcon size={'9xl'} name={'cilSettings'} />
</>
)
Features
- Can load icons stored globally, directly passed or by source link,
- Can significantly reduce bundle size due to JavaScript named icons import,
- Full functionality of svg html tag,
- Clean API
# Icon API
Name | Required | Type | Default Value |
---|---|---|---|
className | string | ||
user classes for the main HTML tag | |||
name | string | ||
name of the icon placed in React object | |||
content | (string | any[]) | ||
icon SVG code | |||
size | (custom | custom-size | sm | lg | xl | 2xl | () | 4xl | 5xl | 6xl | 7xl | 8xl | ArrayOf(string)) | ||
size of the icon; available sizes: 'sm', 'lg', 'xl', 'custom-size' | |||
customClasses | (string | any[] | object) | ||
replacing default CIcon component classes | |||
src | string | ||
Link to the icon. If defined component will be rendered as 'img' tag. | |||
title | string | ||
title tag content | |||
use | string | ||
use SVG tag content |