Form field
Connect a label, a control, a hint and an error.
Installation
bunx --bun shadcn@latest add https://apple-ui-eduardo.vercel.app/r/field.jsonThe registry includes the shared styles and dependencies. Import @/components/apple-ui/styles.css in your root layout once. For the package route, use the installation guide.
Usage
<Field label="Project name" error="Enter a name to continue.">
<Input required aria-invalid />
</Field>Package imports use @eduardoul/apple-ui. Registry imports use @/components/apple-ui. Add "use client" to files that use state or event handlers.
API reference
| Property | Type | Default |
|---|---|---|
| label | ReactNode | required |
| hint | ReactNode | undefined |
| error | ReactNode | undefined |
| controlId | string | generated |
| required | boolean | false |
Use className and style to customize the component. The package includes full TypeScript definitions for its supported element properties and refs.
Design guidance
- Explain how to fix an error next to the affected control.
- Never rely on color alone to identify invalid input.
- When a control with an explicit id is nested inside a wrapper, set Field controlId to that same id. Direct child control ids are resolved automatically.
Accessibility
Provide a visible label or accessible name. Keep keyboard focus visible and check the example with your content at 200 percent zoom. Overlays use Radix for focus management and keyboard dismissal.
Library styles support reduced motion, reduced transparency, increased contrast and forced colors. Read the accessibility foundation for the checks your application still needs.