Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-flat-switch
Advanced tools
Inspired by Oleg Frolov's codepen, React Flat Switch is a toggle/switch component for React.
Inspired by Oleg Frolov's codepen, React Flat Switch is a toggle/switch component for React.
npm install --save react-flat-switch
Live demo: cameronbourke.github.io/example/react-flat-switch
To build the example locally, clone this repo then run:
npm install
npm start
Then open localhost:8080 in a browser.
import React from 'react';
import FlatSwitch from 'react-flat-switch';
class App extends React.Component {
...
render() {
const background = this.state.switchEnabled ? '#2196f3' : '#DCDCDC';
const enabledStyles = {
color: '#2196f3'
};
const disabledStyles = {
color: '#F32121'
};
return (
<section className='container' style={{ background }}>
<FlatSwitch
width={150}
height={40}
enabled={this.state.switchEnabled}
enabledText='enable'
enabledStyles={enabledStyles}
disabledStyles={disabledStyles}
disabledText='disable'
className='list-item--switch'
onSwitch={this.handleOnClick.bind(this)}
/>
</section>
);
}
}
Property | Type | Default | Description |
---|---|---|---|
enabled | bool | (required) | determines which side of the switch is shown |
enableText | string | enable | the text value of the enabled side of the switch |
disableText | string | disable | the text value of the disabled side of the switch |
onSwitch | func | undefined | called when the user clicks the switch |
hideBoxShadow | bool | false | will hide any box shadows used |
width | number/string | 150 | the width of the component |
height | number/string | 40 | the height of the component |
className | string | undefined | the classname of the component |
enabledStyles | object | undefined | style object that will be applied to the enabled side |
disabledStyles | object | undefined | style object that will be applied to the disabled side |
MIT Licensed Copyright (c) Cameron Bourke 2016
FAQs
Inspired by Oleg Frolov's codepen, React Flat Switch is a toggle/switch component for React.
We found that react-flat-switch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.