2.0.0 • Published 11 months ago

jb-button-react v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

JBButton React

this component is React.js wrapper for jb-button web component JBButton is a simple button react component with some additional feature.

  • custom styling

  • loading state

sample: https://codepen.io/javadbat/pen/NWdeMwY

installation

    npm i jb-button-react

in your jsx file

    import {JBButton} from "jb-button-rect"
    <JBButton></JBButton>

instruction

set loading

you can show loading by setting props , isLoading = true you can add text to loading by your button text

other props

props namedescription
typechange button HTML type
disableddisable the button
isLoadingset loading state of button

events

  • onClick
  <JBButton onClick={(event) => console.log(event)}></JBButton>

change button style

the way of injecting style to jb-button is by providing css variable in component parent element to set some atttribute for example to set button height:

.your-jb-button-wrapper{
    /*degualt height of button is 44px but it will change it to 40px*/
    --jb-button-height: 40px;
    /* set button marging for example for zero margin:*/
    --jb-button-margin: 0 0;
}

in some cases in your project you need to change the defualt style of the component for example you need zero margin or different border-radius and etc. if you want to set a custom style to this component all you need is to set css variable in parent scope of the component.

css variable namedescription
--jb-button-margincomponent margin defualt is 16px 0
--jb-button-border-radiuscomponent border-radius defualt is 16px
--jb-button-bordercomponent css border attribute default is none
--jb-button-primary-bgcolorbackground color of button in primary
--jb-button-primary-hover-bgcolorbackground color of button in primary
--jb-button-heightbutton height defualt is 44px
--jb-button-text-shadowbutton text shadow defualt is none
--jb-button-font-weightfont weight of button defualt is bold
--jb-button-font-sizefont size of button defualt is 1.2em
--jb-button-color-hovercolor of buttton in hover state
--jb-button-cursorchange button cursor defualt is pointer
--jb-button-bgcolor-disabledbackground color of button when disabled
--jb-button-color-disabledcolor of button when disabled
--jb-button-cursor-disabledcursor of button when disabled
--jb-button-border-disabledborder of button when disabled
--jb-button-text-shadow-disabledtext shadow of button when disabled
2.0.0

11 months ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago