@crpt/react-icon

1.1.43 • Public • Published

react-icon

Travis npm package Coveralls Storybook

Icon component. Icons are kept in svg-format.

To see demonstration of this component, follow this link: Storybook.

Usage

Classic method

import { Icon } from "@crpt/react-icon";

<Icon type="calendar" />
PropName Описание Пример
type(required): String Icon name. <Icon type="search" />
onClick: Function Callback for the click event. <Icon type="calendar" onClick={e => console.log(e)} />
size: Integer Set size in pixels. <Icon size={16} type="calendar" />
spacingLeft: Integer Set left margin in pixels. <Icon type="calendar" spacingLeft={16} />
spacingRight: Integer Set right margin in pixels. <Icon type="calendar" spacingRight={16} />
withoutMask : bool It disabling mask for svg (If you aren't see svg, try to use this flag)

React way ))

You have to receive React Component with svg icon and use it as you wish

import { Icon } from "@crpt/react-icon";
...
  const ObjectWithIconsAsReactComponent = Icon.svgIconsAsComponents;
  const IconComponent = ObjectWithIconsAsReactComponent['iconFileName'];
...  
  at render:
  <IconComponent {some props} />

How to add the icon

Just copy svg icon to src/svg folder and make.

  npm run build

or

  npm start

Icon will be converted to React Component and moved to src/svgComponents folder.

Readme

Keywords

Package Sidebar

Install

npm i @crpt/react-icon

Weekly Downloads

0

Version

1.1.43

License

MIT

Unpacked Size

861 kB

Total Files

519

Last publish

Collaborators

  • ivanvlado
  • solnik
  • fantik217