react-icon-checkbox
Version:
Icon checkbox component for react
51 lines (39 loc) • 1.42 kB
Markdown
A quick component to build instagram-esque like or heart or favorite button for your application. Or can also be used for building custom toggles or anything that a checkbox can do.
`npm install react-icon-checkbox --save`
```
import React from "react";
import { IconCheckbox } from "react-icon-checkbox";
class App extends React.Component {
constructor(){
this.state = {
checked = false
}
}
_onCheckboxClicked = () => {
this.setState({checked: !this.state.checked});
}
render() {
return (
<IconCheckbox checked={this.state.checked}
checkedIcon={<Icon type="heart" />}
uncheckedIcon={<Icon type="heart-o" />}
onClick={this._onCheckboxClicked} />
);
}
}
export default App;
```
| props | type | default |
|-----------------------|-------------------------|----------|
| checked | boolean | false |
| onClick | func | |
| checkedIcon | string / func / element | |
| uncheckedIcon | string / func / element | |
| iconContainerStyle | style | |
| iconContainerClassName| string | |
* [Bazr](https://bazr.io)