Form Field

A wrapper that pairs any input with its label, required marker, help text and an error message announced with role alert. Keeps React forms consistent.

src/registry/ui/form-field.tsx/r/form-field.json

Installation#

bash
npx shadcn@latest add @minidev/form-field

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/form-field.json

Usage#

tsx
import { FormField } from "@/components/ui/form-field"

export function Example() {
  return (
    <FormField id="email" label="Email"><Input id="email" type="email" placeholder="you@company.com" /></FormField>
  )
}

API reference#

FormField props
PropTypeDefault
idstring-
labelReact.ReactNode-
descriptionReact.ReactNode-
errorReact.ReactNode-
requiredboolean-
classNamestring-
children*React.ReactNode-

* required

Dependencies#

npm

React only

Built from

Examples#

All form components

Learn more