})
return icons;
}
```
### Color
The icon will automatically inherit the `color` property of the external container CSS
You can also modify the color of the icon by setting style props to the Icon.
```jsx live=true
import React from 'react';
import { IconLikeHeart, IconFlag, IconLock, IconUnlock } from '@douyinfe/semi-icons';
() => (
)
```
### Custom icon
You can use custom icons to pass in Icon components
Icon component supports size, rotate, spinning and other attributes
```jsx live=true
import React from 'react';
import { Icon } from '@douyinfe/semi-ui';
() => {
function CustomIcon(){
return
}
return (
} />
} rotate={180} />
)
}
```
### Use svgr to convert svg files into ReactComponent
If the icons provided by Semi are not enough to meet business needs, you can also introduce custom icons through @svgr/webpack and use them as React components
```
// webpack.config.js
{
test: /\.svg$/,
use: ['@svgr/webpack'],
}
import { Icon } from '@douyinfe/semi-ui';
import StarIcon from './star.svg';
} />
```
## API reference
### Icon
| Properties | Illustrate | Type | Default |
|-------|-------------|-----------------|--------|
| className | class name | string | none |
| onClick | Callback event of clicking the icon | (e: Event) => void | None |
| onMouseDown | The callback event of mouse button press >=v1.21 | (e: Event) => void | None |
| onMouseEnter | Callback event of entering icon | (e: Event) => void | None |
| onMouseLeave | Callback event of leaving icon | (e: Event) => void | None |
| onMouseMove | Callback event of moving the mouse >=v1.21 | (e: Event) => void | None |
| onMouseUp | Callback event when the mouse button is raised >=v1.21 | (e: Event) => void | None |
| rotate | degree of rotation | number | |
| size | Size, supports `extra-small`, `small`, `default`, `large`, `extra-large` | string | `default` |
| spin | spin animation | boolean | |
| style | Icon style | CSSProperties | None |
| svg | Icon content | ReactNode | None |