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';
{}
<Switch
checked={!!this.state.cookiesChecked}
onChange={evt => this.setState({cookiesChecked: evt.target.checked})}>
Cookies
</Switch>
{}
<Switch defaultChecked>Pizza</Switch>
{}
<Switch label="Icecream" />
{}
<Switch disabled label="Disabled" />
import { DocumentComponent } from '@rmwc/base/utils/DocumentComponent';
import * as docs from './docgen.json';
<DocumentComponent docs={docs} displayName="Switch" />