开关 Switch
issue

切换开关交互来源于表示用户用于打开或关闭选项的物理开关。

何时使用

使用开关元素展示页面

如何使用

import { Switch } from 'tinper-bee';

or

import Switch from 'bee-switch';
import 'bee-switch/build/Switch.css';

能力特性

API

参数 说明 类型 默认值
checked 指定当前是否选中 Boolean false
defaultChecked 初始是否选中 Boolean false
onChange 变化时回调函数,自定义参照demo Function(checked:Boolean) -
disabled 设置是否禁用 Boolean false
checkedChildren 选中时的内容 React Node
unCheckedChildren 非选中时的内容 React Node
size 大小设置,oneOf:sm, lg string ''
colors 颜色设置,oneOf:primary,success,info,dark,warning'' string ''
onKeyDown 键盘回调 Function -
enterKeyDown 是否启用 enter 和 space 键 Boolean true

已支持的键盘操作

按键 功能
←(左箭) 关闭开关
→(右箭) 打开开关
enter 选中
space 选中

注意事项

暂无

更新日志

  • v2.0.7 2020-04-24 ( release地址 )

    Bug Fixes

  • v2.0.6 2019-08-06 ( release地址 )

    • bee-switch @2.0.6
      • [ Feature ] 新增了switch组件转译之后最外层span的css类名
  • v2.0.5 2019-05-15 ( release地址 )

    • bee-switch @2.0.5
      • [Fixbug]解决控制台警告问题
  • v2.0.4 2019-04-25 ( release地址 )

    • bee-switch @2.0.4
      • [Feature] 新增onKeyDown回调,enterKeyDown开关控制enter事件
  • v2.0.3 2019-04-02 ( release地址 )

    • [Feature]bee-switch @2.0.3,按新规范更新组件