package input import ( "github.com/vugu/vugu" ) // RadioButton provides an option that the user can select. // A group of RadioButtons is defined when they share a data binding. type RadioButton struct { AttrMap vugu.AttrMap Bind ValueBinder // Binds the current selected key to some variable. Key string // The key that this RadioButton represents as a string. } func (c *RadioButton) isChecked() bool { if c.Bind != nil { return c.Bind.StringValue() == c.Key } return false } func (c *RadioButton) handleChange(event vugu.DOMEvent) { if c.Bind == nil { return } if event.PropBool("target", "checked") { c.Bind.SetStringValue(c.Key) } }