0.1.3 • Published 3 years ago
loader-button v0.1.3
what is this?
An easy Button with Loader Functionality component to help you with your needs. includes a varient is used to change background color,text color, and many more on the way, Easyly customizable.
Install
`npm i loader-button --save`
Usage
import React from "react";
import ReactDOM from "react-dom";
import React, { useState, useEffect } from "react";
import LoaderButton from "loader-button";
function App() {
const [ButtonLoading, setButtonLoading] = React.useState(false);
const [loadingSpeed] = React.useState(1);
React.useEffect(() => {
if (ButtonLoading) {
setTimeout(() => {
setButtonLoading(false);
}, 2000 / loadingSpeed);
}
}, [ButtonLoading, loadingSpeed]);
return (
<div className="App">
<div>
<LoaderButton
variant="plain"
size={"lg"}
isLoading={ButtonLoading}
onClick={() => setButtonLoading(true)//button loader}
//onClick={() => setButtonLoading(false)//without loader
>
Button Loader
</LoaderButton>
</div>
</div>
);
}
export default App;
PROPTYPES
Prop | Type | Default |
---|---|---|
Varient | String | |
Size | String |