Field
delego/fieldFreeComponent
Labeled input with optional leading icon and mono hint, lit by the indigo focus halo. Drop-in over a native input.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/Delego-Dev/registry/main/public/r/field.jsonSource
1"use client"23import * as React from "react"45import { cn } from "@/lib/utils"67// Field — a labeled input with an optional leading icon and a mono hint, lit by the8// indigo focus halo on focus-within. Ports the design-system form field; wraps a9// native <input> so it stays a drop-in.10type FieldProps = React.ComponentProps<"input"> & {11 label?: string12 hint?: string13 icon?: React.ReactNode14 trailing?: React.ReactNode15 containerClassName?: string16}1718function Field({19 label,20 hint,21 icon,22 trailing,23 className,24 containerClassName,25 id,26 ...props27}: FieldProps) {28 const reactId = React.useId()29 const inputId = id ?? reactId30 return (31 <div className={cn("flex flex-1 flex-col gap-[7px]", containerClassName)}>32 {label && (33 <label htmlFor={inputId} className="text-[12.5px] font-medium text-foreground/80">34 {label}35 </label>36 )}37 <div className="flex items-center gap-[9px] rounded-[--radius] border border-border bg-popover px-[13px] py-[11px] transition-all duration-200 focus-within:border-[var(--delego-indigo)] focus-within:ring-[3px] focus-within:ring-ring/45 [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-muted-foreground">38 {icon}39 <input40 id={inputId}41 className={cn(42 "w-full bg-transparent font-sans text-sm text-foreground outline-none placeholder:text-muted-foreground/70",43 className44 )}45 {...props}46 />47 {trailing}48 </div>49 {hint && <span className="font-mono text-[10.5px] text-muted-foreground">{hint}</span>}50 </div>51 )52}5354export { Field, type FieldProps }
What it pulls in
Other registry items
Files it writes
More from delego
All 6 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Buttonbutton | delego | Components | Free | 2 deps | |
| Decision Pilldecision-pill | delego | Components | Free | 1 dep | |
| Signed Receiptsigned-receipt | delego | Components | Free | 1 dep | |
| Status Badgestatus-badge | delego | Components | Free | 2 deps |
