Skip to content

Repository files navigation

react-easy-button

Implement easily customize out of the box. Work with a vast number of pre-maid react button themes

1668563583029

Installation

# NPM
npm i react-easy-button
# Yarn
yarn add react-easy-button
# Pnpm 
pnpm add react-easy-button

Simple example

importReactfrom'react'import{EasyButton}from'react-easy-button';constButton: React.FC=()=>{return(<EasyButtonlabel="Press me"/>)}

Custom style

Style

Note: If theme is not equal to custom it will not work

If the style is provided through style prop it will reset previous styles & apply provided style. In this example below button will only have color & background color style. The rest of the styles will be reset. To avoid this use extendStyle prop.

<EasyButtonlabel="Press me"style={{color: "#242424",backgroundColor: "#fcfcfc"}}/>

Extend styles

It will keep all previous styles & only change provided styles. It will work for all themes

<EasyButtonlabel="Press me"extendStyle={{color: "#242424",backgroundColor: "#fcfcfc"}}/>

EasyButton props

AttributesTypeDefault valueDescription
labelstringundefinedRequired. If not provided, will throw error.
titlestringundefinedOptional. Title attribute of html button tag.
themestringprimaryOptional. Available themes (custom, error, success, warn, purple, pink, primary)
debounceTimeoutnumber0Optional. Delaytime in ms (eg. 100 = 100ms))
disabledbooleanfalseOptional
styleobjectundefinedOptional. If provided & theme === "custom" then only provided style will be applyed
extendStyleobjectundefinedOptional. If provided, will change only provided styles. eg. theme="purple" & extendStyle={{border: "2px solid purple"}} it will keep theme styles with provided style border: "2px solid purple"""
hoverStyleobjectundefinedOptional. If mouse entered then provided style will applied
extendHoverStyleobjectundefinedOptional. Provided styles will be applied if mouse entered.
easyRefobjectundefinedOptional. Will return referance of the button
onClickfunctionundefinedOptional. Will run the function if button is clicked
onHoverfunctionundefinedOptional. Will run the function if mouse cursor hovered on the button
onFocusfunctionundefinedOptional. Will run the function if button is focused

License

MIT

About

Implement easily customize out of the box. Work with a vast number of pre-maid react button themes

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages