field
formscn/fieldFreeComponent
Field components for TanStack Form (Field, FieldLabel, FieldError, FieldDescription)
Install it
npx shadcn@latest add https://formscn.space/r/field.jsonSource
1"use client";23import * as React from "react";45import { cn } from "@/lib/utils";6import { Label } from "@/components/ui/label";78const Field = React.forwardRef<9 HTMLDivElement,10 React.HTMLAttributes<HTMLDivElement>11>(({ className, ...props }, ref) => (12 <div13 ref={ref}14 className={cn("space-y-2", className)}15 {...props}16 />17));18Field.displayName = "Field";1920const FieldLabel = React.forwardRef<21 HTMLLabelElement,22 React.ComponentProps<typeof Label>23>(({ className, ...props }, ref) => (24 <Label25 ref={ref}26 className={cn("", className)}27 {...props}28 />29));30FieldLabel.displayName = "FieldLabel";3132const FieldError = React.forwardRef<33 HTMLParagraphElement,34 React.HTMLAttributes<HTMLParagraphElement>35>(({ className, ...props }, ref) => (36 <p37 ref={ref}38 className={cn("text-sm text-destructive", className)}39 {...props}40 />41));42FieldError.displayName = "FieldError";4344const FieldDescription = React.forwardRef<45 HTMLParagraphElement,46 React.HTMLAttributes<HTMLParagraphElement>47>(({ className, ...props }, ref) => (48 <p49 ref={ref}50 className={cn("text-sm text-muted-foreground", className)}51 {...props}52 />53));54FieldDescription.displayName = "FieldDescription";5556export { Field, FieldLabel, FieldError, FieldDescription };
What it pulls in
Other registry items
Files it writes
More from formscn
All 30 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| buttonbutton | formscn | Components | Free | 2 deps | |
| calendarcalendar | formscn | Components | Free | 2 deps | |
| cardcard | formscn | Components | Free | no deps | |
| checkboxcheckbox | formscn | Components | Free | 1 dep | |
| inputinput | formscn | Components | Free | 1 dep | |
| labellabel | formscn | Components | Free | 2 deps | |
| phone-inputphone-input | formscn | Components | Free | 2 deps | |
| popoverpopover | formscn | Components | Free | 1 dep |
