0.0.5 • Published 5 years ago

status-button v0.0.5

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

Status Button

simple customizable status buttons to change the UI ##Installation

npm install status-button --save

##How to use Very simple here's a code snippet of StatusButton andt StatusButtonToggle with default props

import { StatusButton, StatusButtonToggle } from 'status-button';
class App extends React.Component{
    constructor(props)
    {
        super(props)
        this.state={
            status:"something",
            flag:true
        }
    }
    render(){
        return(
                <div style={{height:"100%", width:"100%", marginTop:"120px"}} align="middle">
                    <div>
                        <StatusButton                           
                            buttonClick1={()=>{this.setState({status:"hello"})}}
                            buttonClick2={()=>{this.setState({status:"world"})}}                                                       
                        />
                    </div>
                    <div style={{color:"red"}}>{this.state.status}</div>
                    <StatusButtonToggle
                        onclick={()=>{this.setState((prevState)=>({flag:!prevState.flag}))}}
                    />
                </div>
        )
    }
}

###All the props of StatusButton

  • status1 : left button name | default: "O"
  • status2 : right button name | default: "I"
  • buttonClick1 : pass your left button function here
  • buttonClick2 : pass your right button function here
  • size : give your desired px size (for example size=150) | default: 80
  • backgroundColor : set the inactive button color | default: "lightfgrey"
  • activeColor : set active button color | default: black ###All the props of StatusButton
  • status1 : left button name | default: "O"
  • status2 : right button name | default: "I"
  • onclick : pass your left button function here
  • size : give your desired px size (for example size=150) | default: 80
  • backgroundColor : set the inactive button color | default: "lightfgrey"
  • activeColor : set active button color | default: black