跳转到内容

SwitchUnstyled API

API documentation for the React SwitchUnstyled component. Learn about the available props, and the CSS API.

Import

import SwitchUnstyled from '@mui/base/SwitchUnstyled';
// 或
import { SwitchUnstyled } from '@mui/base';
You can learn about the difference by reading this guide on minimizing bundle size.

属性

Props of the 原生(Native) component are also available.

名称类型默认值描述
checkedboolfalse
classNamestring
componentelementType
components{ Input?: elementType, Root?: elementType, Thumb?: elementType, Track?: elementType
| null }
{}
componentsPropsobject{}
defaultCheckedboolfalse
disabledboolfalse
onChangefunc
readOnlyboolfalse
requiredboolfalse

ref 则会被传递到根元素中。

Demos