Trên trang này

Trang này chưa có bản tiếng Việt, nội dung bên dưới là bản tiếng Anh. Xem trang tiếng Anh

Trường

Install, props and the parts Field is built from.

Install

Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code). It also installs Label and Separator.

npx shadcn-vue@latest add https://beehexa.design/r/field.json

Use

<script setup lang="ts">
import { Field, FieldDescription, FieldError, FieldLabel } from '@/components/ui/field'
import { Input } from '@/components/ui/input'

const error = 'Enter an email address like [email protected].'
</script>

<template>
  <Field data-invalid="true">
    <FieldLabel for="email">Contact email</FieldLabel>
    <Input id="email" type="email" aria-invalid="true" aria-describedby="email-help email-error" />
    <FieldDescription id="email-help">We send sync alerts here.</FieldDescription>
    <FieldError id="email-error">{{ error }}</FieldError>
  </Field>
</template>

Props

Part Prop Values Notes
Field orientation vertical (default), horizontal, responsive Label above, or control beside the label
Field data-invalid, data-disabled "true" Marks the field. data-disabled greys the label
FieldError errors array of strings or { message } Shows one message, or a list without duplicates. Or use the slot
FieldLegend variant legend (default), label font.heading.xsmall or font.label.default
FieldLabel for string The control’s id
All class string Merged with the Beehexa classes

Field does not link ids for you. Set for, id and aria-describedby yourself, or use Form, which does.

Built on

The shadcn-vue Field API (shadcn-vue registry, style reka-nova, read 12 November 2026), with the Beehexa Label and Separator. FieldError has role="alert", so a message that appears is read at once.

Differences from shadcn-vue

  • An invalid field does not turn its label and help text red; only the error message is red.
  • Disabled fields grey the label with color.text.disabled, not opacity.