Skip to content

Switch

A control that allows the user to toggle between checked and not checked.

Example

import { UiLabel, UiSwitch } from '@altdot/extension';
export default function Command() {
return (
<div style={{ display: 'flex', alignItems: 'center' }}>
<UiSwitch id="switch" />
<UiLabel htmlFor="switch">Airplane Mode</UiLabel>
</div>
);
}

Props

NameTypeDescription
defaultChecked?(boolean | 'indeterminate')The checked state of the checkbox when it is initially rendered
checked?(boolean | 'indeterminate')Checked state of the checkbox
onCheckedChange?((value: boolean | 'indeterminate') => void)Fired when the checked state of the checkbox changes
disabled?booleanWhether to disable the checkbox