package input import ( "github.com/vugu/vugu" ) // Dropdown provides several options that the user can choose. type Dropdown struct { AttrMap vugu.AttrMap Bind FieldBinder // Binds the current selected key to some variable. BindList ListBinder // Binds the list content to some list provider. } func (c *Dropdown) currentKey() string { if c.Bind == nil { return "" } return c.Bind.String() } func (c *Dropdown) isKeySelected(key string) bool { if c.Bind == nil { return false } return key == c.Bind.String() } func (c *Dropdown) keyValuePairs() []ListKeyValuePair { if c.BindList == nil { return nil } return c.BindList.ListKeyValuePairs() } func (c *Dropdown) handleChange(event vugu.DOMEvent) { if c.Bind == nil { return } val := event.PropString("target", "value") c.Bind.SetString(val) }