Single or multiple choice input. Great when you need it in concise, horizontal space.
yarn add @konfy/vue-button-group
<vue-button-group :options="options" info="Choose one option:" name="options"/>
<vue-button-group :options="options" info="Choose one option, required:" name="options" required equal/>
<vue-button-group :options="options" info="Choose many options:" name="options" multiple equal/>
property | type | default | comment |
---|---|---|---|
name | String | name of the input | |
info | String | Info on top of the button-group | |
equal | Boolean | false | Buttons have equal size if true |
multiple | Boolean | false | Should allow multiple selection |
options | Array | [] | Array of options. Can be strings or {value, label} pair objects. |
required | Boolean | false | if not required, a 'clear' button will also show up |
default | Any | default selected value. |
property | type | comment |
---|---|---|
value | Any | Selected value |
values | Array [Any] | Array of selected values |
label | String | Selected label |
valid | Boolean | Is valid |
method | args | comment |
---|---|---|
select(option) | option : option value | Select option |
clear() | – | Clear selected options |
validate() | – | Validate |
event | payload | comment |
---|---|---|
value:change | selected option any | on value change |
{
// color
--vue-button-group-text-off: rgba(black, .7);
--vue-button-group-text-hover: black;
--vue-button-group-text-on: white;
// border
--vue-button-group-border-color: rgba(black, .2);
--vue-button-group-border-color-hover: rgba(black, .2);
--vue-button-group-border-color-active: rgba(black, .2);
--vue-button-group-border-radius: 3px;
// background
--vue-button-group-bg: white;
--vue-button-group-bg-hover: transparent;
--vue-button-group-bg-active: rgba(black, .2);
--vue-button-group-selected: #007AFF;
// shadow
--vue-button-group-shadow: 0 1px 5px 0 rgba(black, .3);
--m2-error-color: #EC4B68;
}