This commit is contained in:
2026-08-27 15:24:18 +01:00
parent a2afce3f8d
commit 3ea14b91c0
10 changed files with 812 additions and 4 deletions
+24
View File
@@ -0,0 +1,24 @@
package tui
type Checkbox struct {
Label string
Checked bool
}
func (c *Checkbox) Toggle() {
c.Checked = !c.Checked
}
func (c Checkbox) Render(focused bool) string {
marker := checkBoxUnchecked
if c.Checked {
marker = checkBoxChecked
}
style := labelStyle
if focused {
style = focusedStyle.Bold(true)
}
return style.Render(marker + " " + c.Label)
}