Skip to content

Field

Layout wrapper for form controls: label, helper, and a reserved error row (no layout jump when validation appears). Provides context to Input, Select, Checkbox, and Switch.

Basic

vue
<script setup lang="ts">
import { ref } from 'vue'
import { Field, Input } from 'pomikit-ui'

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

<template>
  <Field label="Name" helper="As shown on invoices" required>
    <Input v-model="name" />
  </Field>
</template>

Controlled error

A Field error wins over child intent validation:

vue
<Field label="Username" :error="serverError">
  <Input v-model="username" />
</Field>

Props

PropNotes
labelVisible label (Input may float it)
helperHint when there is no error
errorControlled message
requiredMarks the control as required
idOptional control id (otherwise generated)

See useFieldContext for custom controls that participate in Field.