API 文档由 Go 源码生成,内容为英文。
type Checkbox struct {
// indeterminate is Base UI's mixed state: the box shows a dash and the
// accessibility value is "mixed", whatever checked says.
}
Checkbox paints one official shadcn checkable control. State remains owned
by the caller and is exposed through a stable typed hit.
构造函数
BeginCheckbox#
func BeginCheckbox(canvas *ui.Canvas, theme ui.Theme, id ui.ID, bounds ui.Rect, checked bool) Checkbox
BeginCheckbox starts a checkbox declaration. Bounds provide only the visual
origin; the official visual remains 16px at default density. ID zero is
preview-only.
方法
Disabled#
func (checkbox Checkbox) Disabled() Checkbox
Disabled paints the official 50% opacity state and retains disabled
accessibility semantics for nonzero IDs.
Indeterminate#
func (checkbox Checkbox) Indeterminate() Checkbox
Indeterminate paints Base UI's mixed state: a primary box with a dash,
exposed as aria-checked="mixed". It takes precedence over Checked.
Invalid#
func (checkbox Checkbox) Invalid() Checkbox
Invalid applies the official destructive validation border and ring.
Label#
func (checkbox Checkbox) Label(label string) Checkbox
Label sets the accessible name without changing visual geometry.
Paint#
func (checkbox Checkbox) Paint() CheckboxResult
Paint draws the checkbox and declares its enlarged desktop hit region.