Switch
胶囊轨道和圆形滑块,在 180ms 内移动。
<Switch label="Send budget alerts" description="Email owners at 80% and 100% of the monthly budget." defaultChecked className="w-400" />import { Switch } from "@logicplanes/kaeso-ui";属性
aria-labelstring无障碍名称,用于没有可见标签的情况。
aria-labelledbystring为其命名的元素的 ID,用于标签位于页面其他位置的情况。
checkedboolean受控时,是否处于选中状态。
defaultCheckedboolean非受控时,是否初始为选中状态。
descriptionReactNode标签下方的一句帮助文字。
disabledboolean将其禁用:无法使用,并显示为变暗。
disabledReasonstring禁用原因,以提示框显示;按钮保持可聚焦,便于阅读原因。
idstring控件的 ID,便于其他位置的标签指向它。
labelReactNode开关的标签。
loadingboolean显示更改正在保存,并在保存完成前忽略点击。
namestring在表单中提交值时使用的字段名。
onCheckedChange((checked: boolean) => void)选中或取消选中时调用,并传入新状态。
readOnlyboolean显示值,但不允许修改。
size"md" | "sm" | "lg" = md开关的尺寸。