This is a react based toggle button component developed using Typescript.
interface Props extends React.Props<Toggle> {
label: string;
style: any;
};
const styles = {
togglebutton: {
marginBottom: 16
}
};
<Toggle label="Simple" style={styles.togglebutton} />
How to pass custom label How to pass custom style Shows the default checked, un-checked toggle icons
const styles = {
togglebutton: {
marginBottom: 16
}
};
<Toggle label="Custom icon" style={styles.togglebutton} uncheckedIcon={} checkedIcon={} />
The above example demonstrates the following: How to pass custom label How to pass custom style How to pass custom icon’s Can use any svg-image as icons for checked, un-checked toggle icons
npm install
npm start
Contributions are always welcome. Just send a pull request. Feel free to contact me GitHub.
Author: vpysaran
The Demo/Documentation: View The Demo/Documentation
Download Link: Download The Source Code
Official Website: https://github.com/vpysaran/react-typescript-toggle
License: MIT
#react #typescript #javascript #web-development