Socket
Socket
Sign inDemoInstall

jb-button-react

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jb-button-react

button react component


Version published
Maintainers
1
Install size
99.4 kB
Created

Readme

Source

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

Keywords

FAQs

Last updated on 23 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc