Radio Group

A group of macOS radio buttons (NSButton .radio). Exactly one option is selected at a time; arrow keys move both focus and selection, and clicking a caption selects its radio.

Usage

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

const sortBy = ref('name')
</script>

<template>
  <MacRadioGroup
    v-model="sortBy"
    aria-label="Sort by"
  >
    <MacRadio value="name">
      Name
    </MacRadio>
    <MacRadio value="kind">
      Kind
    </MacRadio>
  </MacRadioGroup>
</template>

Orientation

The group is vertical by default; set orientation="horizontal" for a row.

Sizes

All five macOS control sizes; regular is the default. Like controlSize in AppKit, size is set on the group and inherited by every MacRadio in it — individual radios have no size prop.

Disabled

Disable the whole group or individual radios.

API

MacRadioGroup Props

PropTypeDefault
modelValue (v-model)string
defaultValuestring
size'extra-large' | 'large' | 'regular' | 'small' | 'mini''regular'
disabledbooleanfalse
orientation'vertical' | 'horizontal''vertical'
namestring
requiredbooleanfalse

orientation only affects the layout: all four arrow keys move the selection either way, as the ARIA radio-group pattern prescribes. With name set, the group renders a hidden input inside a <form> and participates in native form submission.

MacRadioGroup Events

EventPayload
update:modelValuestring

MacRadioGroup Slots

SlotDescription
defaultMacRadio items.

MacRadioGroup Exposed

NameTypeDescription
elRef<HTMLElement | null>The group element.
focus() => voidFocuses the current radio in the group.
blur() => voidRemoves focus from the group.

MacRadio Props

PropTypeDefault
valuestring— (required)
disabledbooleanfalse

MacRadio Slots

SlotDescription
defaultRadio caption.

MacRadio Exposed

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