Checkbox

A macOS checkbox (NSButton .switch). Supports checked, unchecked, and mixed (indeterminate) states; clicking the caption toggles the control, just like an NSButton title.

Usage

vue
<script setup lang="ts">
import { MacCheckbox } from 'macvue'
import { ref } from 'vue'

const checked = ref(false)
</script>

<template>
  <MacCheckbox v-model="checked">
    Show file extensions
  </MacCheckbox>
</template>

States

Pass defaultValue for uncontrolled usage. The model accepts 'indeterminate' for the mixed state; clicking a mixed checkbox resolves it to checked.

Sizes

All five macOS control sizes; regular is the default.

Disabled

API

Props

PropTypeDefault
modelValue (v-model)boolean | 'indeterminate'
defaultValueboolean | 'indeterminate'
size'extra-large' | 'large' | 'regular' | 'small' | 'mini''regular'
disabledbooleanfalse
namestring
valuestring'on'
requiredbooleanfalse

With name set, the checkbox renders a hidden input inside a <form> and participates in native form submission.

Events

EventPayload
update:modelValueboolean | 'indeterminate'

Slots

SlotDescription
defaultCheckbox caption.

Exposed

NameTypeDescription
elRef<HTMLButtonElement | null>The underlying checkbox button.
focus() => voidFocuses the checkbox.
blur() => voidRemoves focus from the checkbox.