Switch
Imports
import {Switch} from 'material-expressive-react';
import {Switch} from 'material-expressive-react/switch';
Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
| disabled | boolean | No | ||
| icons | boolean | No | ||
| name | string | No | ||
| onChange | ((event: Event) => void) | No | ||
| onInput | ((event: InputEvent) => void) | No | ||
| required | boolean | No | ||
| selected | boolean | No | ||
| showOnlySelectedIcon | boolean | No | ||
| value | string | No |
Events
onChange→ DOM eventchangeonInput→ DOM eventinput
Slots
Material Web components frequently use named slots. In React, you can pass slot="..." on children (e.g. <Icon slot="icon" />).
If you need to slot a child component that does not accept a slot prop, use the Slotted utility (see Utilities → Slotted).
Examples
See Storybook for live examples and variants.