Skip to content
+

Switch

Switches are UI elements that let users choose between two states—most commonly on/off.

useSwitch API

Import

import { useSwitch } from '@mui/base/useSwitch';
// or
import { useSwitch } from '@mui/base';
Learn about the difference by reading this guide on minimizing bundle size.

Parameters

checked

defaultChecked

disabled

onBlur

onChange

onFocus

onFocusVisible

readOnly

required

Return value

checked

disabled

focusVisible

getInputProps

inputRef

readOnly