This is your public display name.
Installation
npx logic2b@next add fieldUsage
import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel } from "@/components/ui/field"
<FieldGroup>
<Field>
<FieldLabel htmlFor="username">Username</FieldLabel>
<Input id="username" placeholder="shadcn" />
<FieldDescription>This is your public display name.</FieldDescription>
</Field>
<Field>
<FieldLabel htmlFor="email">Email</FieldLabel>
<Input id="email" type="email" aria-invalid />
<FieldError>Please enter a valid email address.</FieldError>
</Field>
</FieldGroup>
Use field for simple forms or to wrap a single control without react-hook-form.
For forms that need schema validation wired to field state, use the
form component (react-hook-form + zod) instead.
Examples
Horizontal
Pair a control with a label and description side by side.
Require a second step when signing in.
Field Set
Group related fields under a FieldLegend.
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
<FieldGroup>
<Field
orientation="vertical"
>
<FieldLabel
htmlFor="playground-email"
>Email</FieldLabel>
<input
id="playground-email"
type="email"
defaultValue="team@logic2b.com"
className="h-9 rounded-md border bg-background px-3 text-sm"
/>
<FieldDescription>Used for release notifications.</FieldDescription>
</Field>
</FieldGroup>Used for release notifications.
API reference
Generated from the public TypeScript exports in src/ui/field.tsx.
Field
ComponentProps: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
orientation | null | "horizontal" | "vertical" | "responsive" | No | "vertical" | — |
FieldLabel
ComponentProps: React.ComponentProps<typeof Label>FieldDescription
ComponentProps: React.ComponentProps<"p">FieldError
ComponentProps: React.ComponentProps<"div"> & { errors?: Array<{ message?: string } | undefined> }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
errors | Array<{ message?: string } | undefined> | No | — | — |
FieldGroup
ComponentProps: React.ComponentProps<"div">FieldSeparator
ComponentProps: React.ComponentProps<"div">FieldSet
ComponentProps: React.ComponentProps<"fieldset">FieldLegend
ComponentProps: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
variant | "legend" | "label" | No | "legend" | — |
FieldContent
ComponentProps: React.ComponentProps<"div">FieldTitle
ComponentProps: React.ComponentProps<"div">Accessibility contract
Machine-readable behavior and consumer responsibilities for field.
- Support
- Authored behavior
- Pattern
- labelled form field
- HTML fieldset/label
Built-in semantics
- Field labels, descriptions and validation messages can be associated with the nested native control.
Consumer responsibilities
- Connect help and error text with aria-describedby and set aria-invalid only while the value is invalid.