Skip to content
Haze UI

Fieldset

Native fieldset container with legend, optional description, card framing, and automatic disabled propagation.

pnpm dlx shadcn@latest add @haze/fieldset
Open preview in a new tab
Liveno JavaScript

When to use

  • Grouping related address, billing, or profile fields under a shared accessible legend
  • Disabling an entire form section at once while keeping its description legible
  • Separating multi-section settings forms into crisp card panels

When not to use

  • Wrapping a single form control and label; use field instead
  • Exclusive radio choices; use radio-group which supplies its own legend and items

Installation

Add the Haze registry to components.json once, then install Fieldset with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/fieldset
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
legend*string–Accessible group heading rendered as the semantic <legend>.
descriptionstring–Supporting helper text displayed beneath the legend.
disabledbooleanfalseDisables every native control inside the fieldset without dimming the description.
variant"plain" | "card""plain"plain spaces controls without borders; card wraps the group in an elevated hairline surface.
classstring–Extra classes on the <fieldset>.

Keyboard interactions

Tab
Moves focus through enabled controls inside the fieldset, skipping the whole section when disabled

Accessibility

  • Emits a native <fieldset> and <legend> so assistive technologies announce the section context for every child input.
  • Setting disabled disables descendant controls natively while preserving legend and helper text contrast.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Fieldset" with `npx shadcn@latest add @haze/fieldset`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import Fieldset from "@/components/haze/ui/fieldset.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/fieldset.md

  • Customize with real content

    Adapt the Haze fieldset ui for our product. Replace the demo values of these props with our real content: legend, description, disabled, variant, class. Keep the layout, the heading level rules and these accessibility details: Emits a native <fieldset> and <legend> so assistive technologies announce the section context for every child input. Setting disabled disables descendant controls natively while preserving legend and helper text contrast. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using fieldset, check it fits: use it when grouping related address, billing, or profile fields under a shared accessible legend; disabling an entire form section at once while keeping its description legible; separating multi-section settings forms into crisp card panels. Avoid it when wrapping a single form control and label; use field instead; exclusive radio choices; use radio-group which supplies its own legend and items. Alternatives: @haze/field, @haze/frame, @haze/radio-group.

Dependencies

  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog