Form Field
Styled form field relationship built on the form-field primitive.
@zeus-web/form-fieldData Entryzweb add form-fieldGenerated
Playground
Source
Choose the framework entry that matches your application.
html
<script type="module">
import '@zeus-web/form-field/wc/auto'
</script>
<zw-form-field invalid
><zw-form-field-label>Email</zw-form-field-label
><zw-form-field-control><input type="email" /></zw-form-field-control
><zw-form-field-message
>Enter a valid email.</zw-form-field-message
></zw-form-field
>tsx
import {
FormField,
FormFieldControl,
FormFieldLabel,
FormFieldMessage,
} from '@zeus-web/form-field/react'
export function FormFieldExample() {
return (
<FormField invalid>
<FormFieldLabel>Email</FormFieldLabel>
<FormFieldControl>
<input type="email" />
</FormFieldControl>
<FormFieldMessage>Enter a valid email.</FormFieldMessage>
</FormField>
)
}vue
<script setup lang="ts">
import {
FormField,
FormFieldControl,
FormFieldLabel,
FormFieldMessage,
} from '@zeus-web/form-field/vue'
</script>
<template>
<FormField invalid
><FormFieldLabel>Email</FormFieldLabel
><FormFieldControl><input type="email" /></FormFieldControl
><FormFieldMessage>Enter a valid email.</FormFieldMessage></FormField
>
</template>Add
bash
zweb add form-fieldImports
Styled registry component:
tsx
import { FormField } from '@/components/ui/form-field'Primitive React wrapper:
tsx
import { FormField } from '@zeus-web/form-field/react'Web Component entry:
ts
import '@zeus-web/form-field/wc/auto'Props
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | - | Stable field identifier. |
invalid | boolean | - | Marks the field as invalid. |
disabled | boolean | - | Disables the associated control. |
required | boolean | - | Marks the associated control as required. |
Events
No public events documented.
Slots
| Slot | Description |
|---|---|
default | Label, description, control and message content. |
Styling
Uses Tailwind: yes
Theme tokens:
borderbackgroundforegroundring
Internal selectors:
[data-slot=form-field]
Registry
Registry source: available.
Add command: zweb add form-field
Type: component
Dependencies:
@zeus-web/form-field
Registry dependencies:
cnglobals
Files:
templates/react/form-field.tsx→components/ui/form-field.tsxtemplates/vue/form-field.ts→components/ui/form-field.ts
AI usage rules
Do:
- Use the copied Registry wrapper for styled application UI.
Do not:
- Do not assume the headless primitive provides final visual styling.
Examples
React styled usage
tsx
import {
FormField,
FormFieldControl,
FormFieldLabel,
} from '@/components/ui/form-field'
export function Example() {
return (
<FormField required>
<FormFieldLabel>Work email</FormFieldLabel>
<FormFieldControl>
<input type="email" />
</FormFieldControl>
</FormField>
)
}