For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/components/form/switch.md.

switch

开关切换组件,用于二元状态(开/关)的交互控制。

扫码预览

扫码预览 switch

Props

属性名类型默认值必填说明
checkedboolean-否是否选中。如果设置了 checked,则 Switch 将处于受控模式,此时 defaultChecked 将被忽略。
classNamestring-否组件类名
defaultCheckedbooleanfalse否默认选中状态,仅在非受控模式下生效
disabledbooleanfalse否是否禁用。当为 true 时用户无法操作
keystring | number | null-否React key 属性
onChange(checked: boolean) => void-否状态变化时的回调函数
sizeSwitchSize'large'否尺寸
styleCSSProperties-否组件样式