@empe/front-kit-assets
v0.2.0
Published
The boilerplate of creating React SVG icons library for Web and React Native
Readme
React SVG icons library boilerplate
The boilerplate to create a standalone React icons library from your SVG files.
Resource
Installation
# Using npm
npm install @empe/front-kit-assets
# Using yarn
yarn add @empe/front-kit-assetsUsage
For Web (React, Next.js, Expo Web)
import { SomeIcon } from '@empe/front-kit-assets';
function App() {
return (
<div>
{/* You can use color, fill, stroke and other SVG properties */}
<SomeIcon color="#FF0000" width={24} height={24} />
<SomeIcon fill="#00FF00" stroke="#0000FF" width={32} height={32} />
</div>
);
}For React Native (iOS, Android)
For React Native, you need to install the react-native-svg package:
# Using npm
npm install react-native-svg
# Using yarn
yarn add react-native-svgThen you can use the icons in your React Native components:
import { SomeIcon } from '@empe/front-kit-assets';
function App() {
return (
<View>
{/* You can use color, fill, stroke and other SVG properties */}
<SomeIcon color="#FF0000" width={24} height={24} />
<SomeIcon fill="#00FF00" stroke="#0000FF" width={32} height={32} />
</View>
);
}The library will automatically use the correct implementation based on your platform.
Supported Properties
All icons support standard SVG properties, including:
widthandheight: Control the size of the iconcolor: Set the primary color (usually affects fill or stroke depending on the icon)fill: Explicitly set the fill colorstroke: Set the stroke colorstrokeWidth: Control the thickness of strokes
Adding New Icons
- Place your SVG files in the
rawdirectory - Run the build command:
yarn buildThis will optimize the SVGs and generate the React and React Native components.
License
MIT
