BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shadcn-htmx/form-field

Form Field

shadcn-htmx/form-field
FreeComponent

Field-row wrapper composing label + control slot + description + error, auto-wiring aria-describedby and aria-invalid, with a native :user-invalid styling hook. Includes a fieldset/legend group variant. Ships in five flavours; zero JS.

Live preview

live · rendered by the registry
Rendered by shadcn-htmx on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://shadcn-htmx.productdevbook.com/r/form-field.json

Source

registry/ui/form-field.tsxshadcn-htmx.productdevbook.com/r/form-field.json · first 6 KB
1/** @jsxImportSource hono/jsx */
2import type { Child } from "hono/jsx"
3import { cloneElement, isValidElement } from "hono/jsx"
4import { cn, type ClassValue } from "@/registry/lib/cn"
5
6// Form Field — shadcn-htmx, htmx v4 + Tailwind v4.
7//
8// A field-row wrapper that composes a <label>, a single control slot, an
9// optional description, and an optional error message — auto-wiring the
10// label's `for`, the control's `aria-describedby` (description + error ids),
11// and `aria-invalid`. The visual error state is driven by the native
12// `:user-invalid` pseudo-class so the field only "turns red" AFTER the user
13// has interacted and a submit was attempted — no JS, no premature errors.
14//
15// Source of truth (shadcn anatomy — FormField / FormItem / FormLabel /
16// FormControl / FormDescription / FormMessage):
17// repos/shadcn-ui/apps/v4/registry/new-york-v4/ui/form.tsx
18// Upstream couples those parts to react-hook-form via React context. We have
19// no client form runtime, so instead we lift the wiring to the server: one
20// component reads `id`/`invalid`/`description`/`error`, derives the ids, and
21// clones them onto the control child. Same semantic HTML, zero client state.
22//
23// Built on web platform primitives:
24// - <fieldset>/<legend> for grouping multiple controls under one caption.
25// repos/mdn/files/en-us/web/html/reference/elements/fieldset/index.md
26// repos/mdn/files/en-us/web/html/reference/elements/legend/index.md
27// - Constraint Validation + :user-invalid for "show error only after the
28// user tried" styling. :invalid fires before interaction (confusing);
29// :user-invalid fires only after a submit attempt + interaction.
30// repos/mdn/files/en-us/web/css/reference/selectors/_colon_user-invalid/index.md
31// repos/web.dev/src/site/content/en/learn/forms/validation/index.md (#javascript, :user-invalid aside)
32// - aria-describedby to connect the control to its description + error.
33// repos/mdn/files/en-us/web/accessibility/aria/reference/attributes/aria-describedby/index.md
34// repos/web.dev/src/site/content/en/learn/forms/accessibility/index.md ("Help users find the error message")
35//
36// htmx: the field forwards hx-* untouched, so a server can swap the whole
37// field via hx-swap="outerHTML" and flip aria-invalid + inject the error in
38// one shot. See repos/htmx/www/reference.md.
39
40// Root row. `grid gap-2` mirrors shadcn FormItem. The `[&:has(:user-invalid)]`
41// … truncated

Facts

Registry
shadcn-htmx
Type
registry:ui
Access
Free
Files written
0
Licence
MIT
In the index
at or before 2026-08-13
Last confirmed
today

Go to the source

Docs on shadcn-htmx shadcn-htmx.productdevbook.com productdevbook/shadcn-htmx on GitHub Raw registry item This item as JSON

More from shadcn-htmx

All 83 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionshadcn-htmxComponentsFreeno deps
Active Searchactive-searchshadcn-htmxComponentsFreeno deps
Alertalertshadcn-htmxComponentsFreeno deps
Alert Dialogalert-dialogshadcn-htmxComponentsFreeno deps
Aspect Ratioaspect-ratioshadcn-htmxComponentsFreeno deps
Auto Gridauto-gridshadcn-htmxComponentsFreeno deps
Autocompleteautocompleteshadcn-htmxComponentsFreeno deps
Autosize Textareaautosize-textareashadcn-htmxComponentsFreeno deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex