react-icon-checkbox
v1.0.1
Published
Icon checkbox component for react
Downloads
150
Maintainers
Readme
react-icon-checkbox
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.
Install
npm install react-icon-checkbox --save
Usage
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
| props | type | default | |-----------------------|-------------------------|----------| | checked | boolean | false | | onClick | func | | | checkedIcon | string / func / element | | | uncheckedIcon | string / func / element | | | iconContainerStyle | style | | | iconContainerClassName| string | |