Display15
Form1
Playground3
Form fields
Accessible inputs, textarea, searchable select, switch, and slider with shared labels, hints, and error or success messaging.
Overview
Typical form controls with hints, validation styling, searchable select, switch, and slider
Lowercase letters, numbers, and hyphens only.
Token must be at least 32 characters.
Endpoint responded with 200 OK.
0/200
Optional. Shown on the team directory.
Digest of deploys and failed checks.
4
Parallel jobs allowed per workspace (1–16).
tsx
1import {2 FormInput,3 FormTextarea,4 FormSelect,5 FormSwitch,6 FormSlider,7} from "@/registry/ui/form-fields"89<div className="mx-auto w-full max-w-lg space-y-8 text-left">10 <FormInput11 label="Workspace"12 name="workspace"13 placeholder="acme-corp"14 hint="Lowercase letters, numbers, and hyphens only."15 />16 <FormInput17 label="API token"18 name="token"19 type="password"20 placeholder="••••••••"21 error="Token must be at least 32 characters."22 />23 <FormInput24 label="Webhook URL"25 name="webhook"26 placeholder="https://"27 success="Endpoint responded with 200 OK."28 />29 <FormTextarea30 label="Description"31 name="description"32 placeholder="What is this project for?"33 maxLength={200}34 showCount35 hint="Optional. Shown on the team directory."36 />37 <FormSelect38 label="Region"39 placeholder="Choose a region"40 options={[41 { value: "iad", label: "US East (IAD)" },42 { value: "sfo", label: "US West (SFO)" },43 { value: "fra", label: "EU (Frankfurt)" },44 ]}45 />46 <FormSelect47 label="Role"48 placeholder="Search roles…"49 searchable50 searchPlaceholder="Filter roles…"51 options={[52 { value: "owner", label: "Owner" },53 { value: "admin", label: "Admin" },54 { value: "member", label: "Member" },55 { value: "billing", label: "Billing" },56 ]}57 />58 <FormSwitch59 label="Email notifications"60 description="Digest of deploys and failed checks."61 />62 <FormSlider63 label="Concurrent builds"64 hint="Parallel jobs allowed per workspace (1–16)."65 defaultValue={[4]}66 min={1}67 max={16}68 step={1}69 showValue70 />71</div>
Loading state
Use state="loading" to show a spinner on supported controls
tsx
1import { FormInput, FormSelect } from "@/registry/ui/form-fields"23<div className="mx-auto w-full max-w-lg space-y-6 text-left">4 <FormInput label="Verifying domain" state="loading" readOnly value="example.com" />5 <FormSelect6 label="Importing"7 state="loading"8 options={[{ value: "x", label: "Placeholder" }]}9 />10</div>
Props
| Name | Type | Default | Description |
|---|---|---|---|
| ValidationState | type | — | "default" | "error" | "success" | "loading" — inferred from error/success strings unless state is set |
| FormInput / FormTextarea | components | — | label, hint, error, success, state, required, disabled; FormInput adds leftIcon, rightIcon; FormTextarea adds showCount with maxLength |
| FormSelect | component | — | options { value, label, disabled }[], value, onValueChange, searchable, searchPlaceholder, emptyMessage |
| FormSwitch | component | — | label, description, hint, error, success, checked, onCheckedChange |
| FormSlider | component | — | min, max, step, defaultValue, value, onValueChange, showValue, formatValue |