You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
427 B
Go

package input
import (
"github.com/vugu/vugu"
)
// CheckBox is a boolean type input component.
// Similar to a button that can be toggled.
type CheckBox struct {
AttrMap vugu.AttrMap
Bind *bool
}
func (c *CheckBox) isChecked() bool {
if c.Bind != nil {
return *c.Bind
}
return false
}
func (c *CheckBox) handleChange(event vugu.DOMEvent) {
if c.Bind != nil {
*c.Bind = event.PropBool("target", "checked")
}
}