Field

A suite of components for building accessible form fields with labels, descriptions, and error states.

Installation

$ npx shadcn@latest add "/r/field.json"

Usage

This is your public display name.

With Error

Props

Field

PropTypeDefaultDescription
childrenReact.ReactNode-The content of the field.
classNamestring-Additional CSS classes.

FieldLabel

PropTypeDefaultDescription
childrenReact.ReactNode-The label text.
classNamestring-Additional CSS classes.

FieldControl

Note: FieldControl is used with the render prop pattern for custom inputs. For simple cases, you can place the Input directly inside Field.

PropTypeDefaultDescription
render(props) => React.ReactNode-Render function for custom input.
classNamestring-Additional CSS classes.

FieldDescription

PropTypeDefaultDescription
childrenReact.ReactNode-The description text.
classNamestring-Additional CSS classes.

FieldError

PropTypeDefaultDescription
childrenReact.ReactNode-The error message text.
classNamestring-Additional CSS classes.