A lightweight and extensible React library for displaying SVG icons via CSS masks. Allows you to use monochrome icons with customizable color, size, and styles.
- πΉ Support for SVG via CSS
mask-image - π¨ Change color via
background-color - π¦ Lightweight and easy integration
- βοΈ Flexibility β you can use
childrenfor arbitrary content - π± Support for custom classes, sizes, and styles
npm install react-icon-mask-libimport React from 'react'
import { Icon } from 'react-icon-mask-lib'
// Your svg file when loaded through children
import { ReactComponent as CheckIcon } from './icons/check.svg'
const App = () => {
return (
<div>
// Icon with a name from public/icons
<Icon name='arrow-right' size={32} color='#2593F2' />
// Icon via children
<Icon size={32} color='#4caf50'>
<CheckIcon />
</Icon>
// Icon with a custom class
<Icon
name='user'
size={40}
color='white'
className='bg-gray-800 rounded-full shadow-lg'
/>
</div>
)
}
export default App