1.0.1 • Published 3 years ago

react-icon-checkbox v1.0.1

Weekly downloads
17
License
MIT
Repository
github
Last release
3 years ago

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

propstypedefault
checkedbooleanfalse
onClickfunc
checkedIconstring / func / element
uncheckedIconstring / func / element
iconContainerStylestyle
iconContainerClassNamestring

Who's using it

1.0.1

3 years ago

1.0.0

3 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago