Checkbox - Radio

GITHUB

To create full featured check boxes (even radio buttons) element use this component.


Code:

  
HTML
<!-- Radio Button (one of items can be selected) --> <fvCheck v-model="radioInput" content="mil"> A.C. Milan </fvCheck> <fvCheck v-model="radioInput" content="liv"> Liverpool </fvCheck> <fvCheck v-model="radioInput" content="fcb"> Barcelona </fvCheck> <fvCheck v-model="radioInput" content="mad" disabled> Real Madrid C.F. </fvCheck> <!-- Check Box (multiple items can be selected) --> <fvCheck v-model="checkInput" content="ir" multiple> English </fvCheck> <fvCheck v-model="checkInput" content="it" multiple> Italy </fvCheck> <fvCheck v-model="checkInput" content="es" multiple disabled> Spain </fvCheck>
  
Javascript
export default { data () { return { radioInput: undefined, checkboxInput: [] } } }

Examples:

A.C. Milan
Liverpool
Barcelona
Real Madrid C.F.

Iran
Italy
Spain
Germany

Disabled Radio Button
Disabled Check Box

Foo #1
Foo #1

Bar #1
Bar #2


Notes:

  • There is difference between value and content prop and it's can make you confused in first look. Reading source of examples can help you.
  • The display css prop of checkbox is inline-flex, so do not change it to block or ... for custom styles.

API:

NameTypeDefaultDescription
value*
---
---
Value of input.
content*
---
---
Content of current box that will be put/set to value.
required
Boolean or Function
false
Does value prop required to fill? Also with function type you can pass function with one argument (fn(value){}) and return Boolean value.
disabled
Boolean
false
Does checkbox disabled?
multiple
Boolean
false
Allow user to check multiple items. If it's true, check box will show to user and behave to value prop as Array and if it's false, radio button will show and content prop directly set to value on click.
NameParamsDescription
input
newValue
Fired when component request to change value.
NameDescription
default
Used for label of check box.
NameDescription
.fv-size-xs
XSmall size
.fv-size-sm
Small size
.fv-size-md
Medium size (actived by default)
.fv-size-lg
Large size
.fv-size-xl
XLarge size