New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@rmwc/switch

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rmwc/switch

RMWC Switch component


Version published
Weekly downloads
4.4K
decreased by-7.89%
Maintainers
1
Weekly downloads
 
Created

Switches

On/off switches toggle the state of a single settings option. The option that the switch controls, as well as the state it’s in, should be made clear from the corresponding inline label. Switches take on the same visual properties of the radio button.

Switches are identical in function to the Checkbox component, they just present a different UI / UX paradigm.

import { Switch } from '@rmwc/switch';

{/* Controlled with change handler */}
<Switch
  checked={!!this.state.cookiesChecked}
  onChange={evt => this.setState({cookiesChecked: evt.target.checked})}>
  Cookies
</Switch>

{/* Uncontrolled Switch */}
<Switch defaultChecked>Pizza</Switch>

{/* Using the label prop */}
<Switch label="Icecream" />

{/* Disabled */}
<Switch disabled label="Disabled" />
import { DocumentComponent } from '@rmwc/base/utils/document-component';
import * as docs from './docgen.json';

<DocumentComponent docs={docs} displayName="Switch" />

Keywords

FAQs

Package last updated on 28 Nov 2018

Did you know?

Socket

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.

Install

Related posts