Coder Social home page Coder Social logo

o-faro / react-icon-system Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kosai106/react-icon-system

0.0 0.0 0.0 341 KB

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

Home Page: https://www.npmjs.com/package/react-icon-system

License: MIT License

TypeScript 100.00%

react-icon-system's Introduction

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 React from "react";
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 React from "react";
import Icon from "react-icon-system";

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

react-icon-system's People

Contributors

kosai106 avatar o-faro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.