astryi/react-easy-button

Repository files navigation

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

1668563583029

# NPM
npm i react-easy-button

# Yarn
yarn add react-easy-button

# Pnpm 
pnpm add react-easy-button
import React from 'react'
import {EasyButton} from 'react-easy-button';

const Button: React.FC = () => {
    return (
	<EasyButton label="Press me" />
    )
}

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.

<EasyButton label="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

<EasyButton label="Press me" extendStyle={{color: "#242424", backgroundColor: "#fcfcfc"}} />
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

MIT

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published