menu
Dark Mode
backgroundLayer 1
preact-material-components
Components and their props
  • Switch
    • disabled true/false
      Disables the switch.
    • checked true/false
      Tells if the switch is checked.
Sample code
import {h, Component} from 'preact';
import Switch from 'preact-material-components/Switch';
import 'preact-material-components/Switch/style.css';

export default class SwitchPage extends Component {
  render(){
    return (
      <div>
        <Switch/>
      </div>
    );
  }
}
Original documentation
This component encapsulates mdc-switch, you can refer to its documentation here.
Demo
Default
<Switch />
Checked
<Switch checked />
Disabled
<Switch disabled />