Skip to content

GkCheckbox

Native <input type="checkbox"> with tokenized focus styles, wrapped in an inline-flex container so it aligns with adjacent labels. Pair with a visible <label> or pass ariaLabel.

When to use

Use for binary choices and “select all” controls where each option can be independently toggled.

Live Examples

Basic

Boolean v-model with a visible label.

Native value & indeterminate

Optional value attribute; indeterminate is cleared after the user toggles.

Best practice: Use indeterminate only for partial selection, not as a third persistent state.

Readonly

Readonly prevents toggling while keeping focus styles.

API

Props

PropTypeDefaultDescription
modelValuebooleanrequiredChecked state (v-model)
idstringOverrides injected field id
namestringForm name
valuestringNative value attribute (e.g. for named groups)
disabledbooleanfalseDisabled
readonlybooleanfalsePrevents toggling; uses aria-readonly and reverts change (native readonly is not used on checkboxes)
indeterminatebooleanfalseSets the native indeterminate state (separate from checked)
ariaLabelstringRequired when there is no visible label
size'xs' | 'sm' | 'md' | 'lg' | 'xl'Scales the control and related type size; omit for global defaults

Root class applies to the outer wrapper; other attributes are forwarded to the <input>.

Events

EventPayloadDescription
update:modelValuebooleanEmitted when the checked state changes
update:focusedbooleantrue on focus, false on blur

Expose

NameTypeDescription
inputHTMLInputElementThe native checkbox element

Examples

Each scenario under Live Examples includes a copyable Vue snippet.

Accessibility notes

  • Provide visible label text or ariaLabel so each checkbox has a clear accessible name.
  • Use indeterminate only to communicate partial selection state, not as a third boolean value.

Released under the MIT License.