Checkbox
#

Checkboxes allow the user to select multiple options from a set.

Examples
#

Standard
#

Perfectly works with v-model by default.

Open in GitHub

Label
#

You can add a label text by setting the label property. You can also set the left-label property to move your label on the left side of a checkbox.

Open in GitHub

Indeterminate
#

Open in GitHub

Coloring
#

Open in GitHub

Grouped (Array)
#

Just add the same v-model to multiple checkboxes, and set the array-value prop.

[ "one", "four" ]
Open in GitHub

Errors
#

You can show your error messages while using va-checkbox with form.

Open in GitHub

API
#

Props #

NameDescriptionTypesDefault
ariaLabel

The aria-label of the checkbox

String

-

arrayValue

Same as native value. It is used with v-model of an array type.

String | Boolean | Object | Number

null

checkedIcon

Overrides the checked icon

String

"va-check"

color

Color of the component (theme string or HEX string).

String

"primary"

dirty

Sets the dirty state of the component

Boolean

false

disabled

Applies disabled style and removes all user interaction effects.

Boolean

false

error

Show component in error state.

Boolean

-

errorCount

Number of error messages displayed.

String | Number

1

errorMessages

Error messages for the component.

Array | String

-

falseValue

Overrides the returned value when it's not checked.

any

false

id

Applies id to internal input component. Useful for native forms.

String

""

immediateValidation

Sets the validation to be performed when the component is mounted

Boolean

false

indeterminate

Same as native indeterminate - a state in which it's impossible to say whether the item is toggled on or off

Boolean

false

indeterminateIcon

Overrides the indeterminate icon

String

"remove"

indeterminateValue

Overrides a state value that is not set.

Boolean | Array | String | Object

null

label

Same as native label.

String

""

leftLabel

Moves the label on the left of a component.

Boolean

false

loading

Indicates that something is loading (spinner icon).

Boolean

false

messages

Description messages for the component.

Array | String

[]

modelValue

The value of the v-model bindings.

Boolean | Array | String | Object

false

name

Applies name to internal input component. Useful for native forms.

String

""

preset

Named preset combination of component props.

String | Array

-

readonly

Doesn't look disabled, but acts like one. Mostly useful for wrapper components.

Boolean

false

rules

Validation rules .

Array

[]

stateful

Add possibility to work with component without setting v-model.

Boolean

false

success

Show component in success state.

Boolean

false

trueValue

Overrides the returned value when it's checked.

any

true

vertical

Boolean

false

Events #

NameDescription

blur

On blur.

focus

On focus.

input

Emitted when the component needs to change the value. The event argument is:

(event: Event) => void

update:dirty

Fires when the dirty state changes

update:error

Fires when the error state changes

update:errorMessages

Fires when the error messages change

update:modelValue

The event is triggered when the component needs to change the model. Is also used by v-model and must be listed after the v-model

Css Variables #

NameDefault Value
--va-checkbox-display inline-block
--va-checkbox-input-padding 0
--va-checkbox-input-cursor pointer
--va-checkbox-disabled-cursor default
--va-checkbox-readonly-cursor initial
--va-checkbox-label-display inline-block
--va-checkbox-label-cursor pointer
--va-checkbox-font-size 15px
--va-checkbox-line-height 20px
--va-checkbox-background transparent
--va-checkbox-square-width 1.25rem
--va-checkbox-square-min-width 1.25rem
--va-checkbox-square-height 1.25rem
--va-checkbox-square-border solid var(--va-form-element-border-width) var(--va-background-border)
--va-checkbox-square-border-radius calc(var(--va-form-element-border-radius) / 2)
--va-checkbox-horizontal-gap 0.5em
--va-checkbox-vertical-gap 0.3em
--va-checkbox-vertical-padding var(--va-checkbox-vertical-gap) 0 var(--va-checkbox-vertical-gap) var(--va-checkbox-horizontal-gap)
--va-checkbox-horizontal-padding 0 var(--va-checkbox-horizontal-gap)
--va-checkbox-right-padding 0 var(--va-checkbox-horizontal-gap) 0 0
--va-checkbox-left-padding 0 0 0 var(--va-checkbox-horizontal-gap)

Change log #

v1.8.0
  • Checkbox have outlined style by default

  • Added preset="solid"