Skip to content

Kosai106/react-icon-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

62 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

react-icon-system

React-icon-system setup illustration
License MIT NPM version Dependencies NPM Downloads/week PRs Welcome Code style

Usage

Installation

yarn add react-icon-system

Example

# Folder structure example
src/
โ”œโ”€โ”€ components/
โ”‚   โ””โ”€โ”€ YourComponent.js
โ””โ”€โ”€ images/
    โ””โ”€โ”€ icons/
        โ”œโ”€โ”€ alert.svg
        โ”œโ”€โ”€ info.svg
        โ””โ”€โ”€ warning.svg
# package.json
"start": "REACT_APP_ICON_PATH=src/images/icons ...etc",

OR

# .env
REACT_APP_ICON_PATH=src/images/icons
// Code
import Icon from "react-icon-system";

const YourComponent = () => <Icon src="alert" />;

Pro tips

Instead of using a static colour for your SVGs, use currentColor. This way you can dynamically change the icon colour by using CSS.

Example:

// SVG icon
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg">
  <path stroke="currentColor" fill="none" d="..." />
                    ^
</svg>
// Code
import Icon from "react-icon-system";

const YourComponent = () => (
  <>
    <Icon src="alert" style={{ color: "red" }} />
    <Icon src="info" style={{ color: "blue" }} />
    <Icon src="warning" style={{ color: "yellow" }} />
  </>
);

// Or using Tailwind
const YourComponent = () => (
  <>
    <Icon src="alert" className="text-red-500" />
    <Icon src="info" className="text-blue-500" />
    <Icon src="warning" className="text-yellow-500" />
  </>
);

About

๐ŸŒ€ A simple no-nonsense icon system for React

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

โšก