Text Field ​

A macOS single-line text field (NSTextField). The focus ring appears on any focus, keyboard or pointer — the macOS behavior for text input. There is no built-in label: pair the field with your own label element or an aria-label.

Usage ​

vue
<script setup lang="ts">
import { MacTextField } from '@macvue/core'
import { ref } from 'vue'

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

<template>
  <MacTextField
    v-model="name"
    aria-label="Name"
  />
</template>

Labelling ​

The field ships without a built-in label — NSTextField labels are separate elements. Pair it with a <label for>: the id falls through to the inner input.

Placeholder ​

Native attributes such as autocomplete, readonly and maxlength fall through to the inner <input>; class and style land on the wrapper.

Sizes ​

All five macOS control sizes; regular is the default.

Disabled ​

API ​

Props ​

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

With name set, the field participates in native form submission.

Events ​

EventPayload
update:modelValuestring

Exposed ​

NameTypeDescription
elRef<HTMLInputElement | null>The underlying input element.
focus() => voidFocuses the input.
blur() => voidRemoves focus from the input.