Forms

Checkbox

A native checkbox with a considered check: the box fills, then the tick draws itself in.

Copy
<script setup lang="ts">
const accepted = ref(true)
</script>

<template>
  <JCheckbox v-model="accepted" label="I agree to the terms of service" />
</template>

Installation #

With the Nuxt module, every component is auto-imported — there is nothing to add. In a plain Vue project, import what you use:

Copy
import { JCheckbox } from '@juxtui/ui'

Usage #

Copy
<JCheckbox v-model="accepted" label="I agree to the terms" />

Variants & examples #

With description#

A summary of activity, every Monday.
Only when someone mentions you directly.
Copy
<script setup lang="ts">
const digest = ref(true)
const mentions = ref(false)
</script>

<template>
  <div class="flex flex-col gap-4">
    <JCheckbox v-model="digest" label="Weekly digest" description="A summary of activity, every Monday." />
    <JCheckbox v-model="mentions" label="Mentions" description="Only when someone mentions you directly." />
  </div>
</template>

Indeterminate#

For “select all” rows where only some children are checked.

Disabled#

Copy
<template>
  <div class="flex flex-col gap-4">
    <JCheckbox label="Unavailable option" disabled />
    <JCheckbox :model-value="true" label="Required by your plan" disabled />
  </div>
</template>

API #

Props

PropTypeDefault Description
modelValuebooleanfalseBound with v-model.
labelstring—Label text. The default slot overrides it.
descriptionstring—Supporting text under the label.
indeterminatebooleanfalseShows a dash. Set by you, typically from the state of child checkboxes.
disabledbooleanfalseDisables the checkbox.
requiredbooleanfalseNative required.
namestring—Form field name.
valuestring—Form value when checked.

Events

EventPayload Description
update:modelValuebooleanEmitted when toggled.

Slots

SlotProps Description
default—Custom label content.
description—Custom description content.

Accessibility #

  • Built on a native <input type="checkbox">, visually replaced but never removed — forms, autofill and screen readers behave as expected.
  • indeterminate is applied as the DOM property, so it is announced as “mixed”.
  • The hit area extends a few pixels beyond the box for easier pointer use.

Keyboard #

Key Action
SpaceToggles the checkbox.