来源:docs/kit/components/checkbox.md · API 参考

Checkbox

何时使用

最小示例

require "tessell/kit"

checkbox = Tessell::Kit::Checkbox.new(
  Tessell::UI::UiKey.root.child(1_u64),
  "Enable notifications",
  checked: true
)
checkbox.on_change = ->(value : Bool) { @notifications = value; nil }

状态

事件

键盘

键行为
Tab / Shift+Tab由 Root 焦点环移动
Space切换

无障碍

主题 token

框体使用 surface/border/accent;勾与半选线使用 accent_foreground 或前景色;焦点环使用 focus。

限制