functions

Checkbox
Edited: Sunday 25 January 2026

Checkbox

Category: Components
File: form.go
Package: ui

Signature

1func Checkbox(btn *Clickable, value bool, onclick func()) W

Description

Checkbox creates an interactive checkbox that calls onclick when toggled.
Automatically handles click detection and state visualization.

Example:

btn := &Clickable{}
enabled := false
checkbox := Checkbox(btn, enabled, func() {
    enabled = !enabled
    fmt.Println("Toggled to:", enabled)
})

This widget manages the click handling internally, you provide the callback.

Examples

Checkbox

1{
2	btn := &Clickable{}
3	enabled := false
4	_ = Checkbox(btn, enabled, func() {
5		enabled = !enabled
6	})
7}

Example Output


This documentation is auto-generated. To update, run make docs

Backlinks