• Stars
    star
    220
  • Rank 180,422 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

It makes it very simple to use SVG icons in your React and React-Native projects.

React-Icomoon Logo

Build Status npm npm License

It makes it very simple to use SVG icons in your React and React-Native projects.

Cheatsheet - Interactive Demo - Buy Me a Coffee

Install

npm install react-icomoon
yarn add react-icomoon

Usage

You can use svgps.app to access over 40,000 free icons and convert your own icons into selection.json.

Or you can use IcoMoon to generate the selection.json file.

Declare

// Icon.jsx
import IcoMoon from "react-icomoon";
import iconSet from "./selection.json";

const Icon = (props) => <IcoMoon iconSet={iconSet} {...props} />;

export default Icon;

With TypeScript

// Icon.tsx
import IcoMoon, { IconProps } from "react-icomoon";
import iconSet from "./selection.json";

const Icon = (props: IconProps) => <IcoMoon iconSet={iconSet} {...props} />;

export default Icon;

Use

import Icon from "./Icon";

<Icon icon="pencil" size={20} color="orange" />;

Props List

Name Type Default Sample
iconSet Object - "selection.json file content"
icon String - "home"
size Number,String - "1em", 10, "100px"
color String - "red", "#f00", "rgb(0,0,0)"
style Object {...} { color: '#ff0'}
title String - "Icon Title"
className String - "icomoon"
disableFill Boolean - true
removeInlineStyle Boolean - true

Default Style

{
  display: "inline-block",
  stroke: "currentColor",
  fill: "currentColor",
}

iconList

You can use the iconList method to see a complete list of icons you can use.

import IcoMoon, { iconList } from "react-icomoon";

iconList(iconSet);

// sample output
[
  "document",
  "camera",
  "genius",
  "chat",
  "heart1",
  "alarmclock",
  "star-full",
  "heart",
  "play3",
  "pause2",
  "bin1",
];

React Native 🎉Demo

Step 1: Install Dependencies

npm install react-icomoon react-native-svg
yarn add react-icomoon react-native-svg

Step 2: Declare

Additional props for React Native

Name Type Default Sample
native Boolean - true
SvgComponent React.Component - SvgComponent
PathComponent React.Component - PathComponent
// Icon.jsx
import IcoMoon from "react-icomoon";
import { Svg, Path } from "react-native-svg";
import iconSet from "./selection.json";

const Icon = (props) => (
  <IcoMoon
    native
    SvgComponent={Svg}
    PathComponent={Path}
    iconSet={iconSet}
    {...props}
  />
);

export default Icon;

Step 3: Use

import Icon from "./Icon";

<Icon icon="pencil" size={20} color="orange" />;

Related Links

More Repositories

1

regexlearn.com

Learn RegEx step by step, from zero to advanced.
TypeScript
3,366
star
2

Json-Function

It allows you to use methods such as schema, innerJoin, where, limit, select, orderBy on JSON data.
TypeScript
751
star
3

svgps.app

SVGPS converts your icons into a single JSON file that is ready to use in your frontend or mobile projects.
TypeScript
293
star
4

svg-quick-editor

SVG Quick Editor is a free and open-source SVG editing tool. It offers features such as editing SVG colors, viewing or deleting their paths.
JavaScript
111
star
5

lookie

Store your data in localStorage with optional expiration time. Almost like a cookie.
TypeScript
82
star
6

drain-js

Makes smooth transitions between two numbers.
TypeScript
46
star
7

ymir-js

This toolkit is created to make it easier for you to develop games like chess, checkers, go, match 3 puzzle and more. It is still under development.
TypeScript
35
star
8

nginx-cli

It is a command line tool that will simplify Nginx operations.
JavaScript
32
star
9

mastertime

Timer management library.
JavaScript
31
star
10

javascript-sheets

JavaScript hakkında açıklayıcı Türkçe örnekler.
29
star
11

react-leblebi

Autocomplete Component for React
JavaScript
28
star
12

enwords

Analyze and Track English Words - Chrome Extension
JavaScript
27
star
13

vue-icomoon

With vue-icomoon you can easily use the icons you have selected or created in icomoon.
Vue
26
star
14

checkers.place

It is a 3D, minimal and online checkers game.
TypeScript
24
star
15

svgps

Svg Parser
TypeScript
17
star
16

jquery-to-javascript

Converts simple jQuery codes to javascript codes.
TypeScript
16
star
17

focus-wo-extension

FocusWo extension lists the words of the text in the active browser tab by frequency of use. It also allows you to search between words.
Vue
9
star
18

react-dropdown-wrapper

Convenient, simple, quick dropdown menu wrapper for accessibility.
JavaScript
9
star
19

LinkRunner

Creator Sitemap with PHP
PHP
7
star
20

leblebi.js

Cool and easy to autocomplete library. ⚡️
JavaScript
7
star
21

tardiness.js

Simple and easy encryption. Less than 1 kb.
JavaScript
6
star
22

react-colorful-avatar

JavaScript
6
star
23

svelte-icomoon

It makes it very simple to use SVG icons in your Svelte projects.
JavaScript
5
star
24

class-methods-binder

"class-methods-binder" is an easy and standart way to bind the method.
TypeScript
5
star
25

rn-colorful-avatar

Colorful Avatar for React Native
JavaScript
4
star
26

status-code-check

Status code check of URLs
Go
4
star
27

File-Explorer

Read Dir and Walk in Dir
JavaScript
4
star
28

Array-Interface-Helper

Array Interface for PHP
PHP
3
star
29

syscli

System Information View and Search
JavaScript
3
star
30

react-ifelse

Condition Components for React
JavaScript
3
star
31

awesome-muninn

Muninn common configs and utils
3
star
32

svgps-cli

This project is the CLI version of the svgps package.
TypeScript
2
star
33

preact-icomoon

It makes it very simple to use SVG icons in your Preact projects.
TypeScript
2
star
34

next-boilerplate

Next.js 9 with typescript, mobx, axios, sass(+autoprefixer), bootstrap and more...
JavaScript
2
star
35

compute-svg-data

It is a common helper for "*-icomoon" packages.
TypeScript
2
star
36

get-obj-deep-prop

Check and get object prop.
JavaScript
2
star
37

FEXCH4NGE

Candy Crush Coding...
JavaScript
1
star
38

json-function-query-builder

Query Builder UI for Json-Function
1
star
39

word-counter.js

Word Counter
JavaScript
1
star
40

html-vschema

html-vschema creates a simplified and manipulable schema of html.
TypeScript
1
star
41

Qirpi

Jquery Alternative Library
JavaScript
1
star
42

React-ZwIcon

ZwIcon for ReactJS
JavaScript
1
star
43

gulp-scss-dom

Use of SCSS features in HTML elements.
JavaScript
1
star
44

scss-dom

Use of SCSS features in HTML elements.
JavaScript
1
star
45

Country-Worn-Theme

Lightweight, simple and traditional. Brackets Theme
1
star
46

turkish-checkers

Turkish Checkers game made with ymir-js
JavaScript
1
star
47

international-checkers

International Checkers game made with ymir-js
JavaScript
1
star
48

typescript-starter-kit

Typescript starter kit with unit test.
TypeScript
1
star