This package is yet another React component library for bytesize-icons. bytesize-icons is a SVG based, nice and reasonable icon set.
$ npm install --save react-component-bytesize-icons react react-dom
import * as React from 'react'; import Icon from 'react-component-bytesize-icons'; const Message = (props) => ( <div> Search icon: <Icon name="search"/> Thin large icon: <Icon name="book" thickness="thin" size="larger"/> Thick small icon: <Icon name="flag" thickness="bold" size="small"/> </div> );
The name
property is corresponding to described icons in [bytesize-icons repo's README][]. You can also see the bottom section of this README to know all available icons.
<Icon/>
Component Property Description Default name
Name of icon (required). N/A thickness
Line thickness (optional). regular
size
Size of icon (optional). regular
thickness
takes one of ultra-light
, thin
, light
, regular
, medium
, bold
or heavy
.
size
takes one of small
, regular
, larger
or largest
. small
is 24px
, regular
is 32px
, larger
is 48px
and largest
is 64px
. With these size, icons are rendered the best. You should choose one from them and tweak the size with CSS.
You can also see type definition file for more detail.
There is already a React component package for bytesize-icons but I created this for the below points
Easy to tweak icon size and weightreact-bytesize-icons directly shows <svg>
element's props such as height
or strokeWidth
. It means that user must calculate icons' stroke width by its size and thickness. react-component-bytesize-icons calculates the best strokeWidth
, height
and width
attributes of <svg>
from thickness
prop and size
prop.
I didn't directly write index.tsx. It's generated with Ruby script. It generates TypeScript code by referring bytesize-icons repository directly.
This package is checked at 3 stages.
Of course you can use this package in safe way using TypeScript because this package contains its type definitions. Type definitions are also tested.
This package depends on no package.
# Install development dependencies $ npm install # Generate index.tsx and compile it $ npm run gen # Check code style $ npm run lint # Run tests $ npm test
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4