Skip to content

Repository files navigation

ReScript React Feather

License: GPL v3

ReScript binding generator for the react-feather library

Installation

First run the below commands to install the dependencies:

yarn add @heliaxdev/rescript-react-feather react-feather

Then, add @heliaxdev/rescript-react-feather to bs-dependencies, i.e.:

{
"bs-dependencies": [
"@rescript/react",
"@heliaxdev/rescript-react-feather"
],
}

And you should be good to go.

Usage

This library can be used in two ways:

Zero-cost bindings

This library has zero-cost bindings for every icon in the official TypeScript type definitions.

You can use them like this:

moduleCancelButton= {
@react.componentletmake= () => {
<buttonariaLabel="Cancel this, please">
<ReactFeather.Xcolor="red"size=20className="my-cross-icon" /> </button>
}
}

Icon component

Aside from the zero-cost bindings, this library also generates an <Icon /> component that receives an icon name polyvariant as a prop.

It can be used like this:

moduleConfirmButton= {
@react.componentletmake= () => {
<buttonariaLabel="Confirm this, please">
<ReactFeather.Iconname=#Checkcolor="green"size=20className="my-check-icon" />
</button>
}
}

Props

Except for the extra name prop in ReactFeather.Icon, all components have the following type:

externalmake: (~color: string=?, ~size: int=?, ~className: string=?) =>React.element

About

ReScript bindings generator for the react-feather icon library

Resources

Stars

6 stars

Watchers

6 watching

Forks

Releases

Packages

Contributors

Languages