Allows a user to have several options they can click to toggle on and off.
$ component install dominicbarnes/buttonset
buttonset("#my-element")
.multiple()
.option("a", "Letter A")
.option("b", "Letter B", { disabled: true }) // disabled on init
.option("c", "Letter C", { active: true }) // active on init
.option("d", "Letter D");Initializes a new selection group at the input element. (el can be either
an HTMLElement or a CSS selector String)
Allows multiple options to be selected (default is to only allow 1 to be active at a time)
Adds a new option to the menu. value is the actual value of the selection
(must be unique to this option) label is the HTML content of the label to be
presented to the user.
options is an optional way for you to set the state upon initialization. It
is an object with 2 possible keys: disabled and active (each does what you
expect)
Alias: selected
Retrieves the selected options. By default, it will return a single value.
If multiple has been enabled, it will be an Array of values.
If a value is specified, it will act as a setter instead.
change: Emitted whenever a option is changed