Fieldset
Group related controls under a shared legend and disabled state. Describe the group with FieldsetLegend and retain labels on individual controls.
@neumorphism-ui/fieldsetPreview
Installation
Installation: fieldset
npx shadcn@latest add @neumorphism-ui/fieldsetThe CLI resolves npm dependencies, base tokens, utilities, and component source in order.
New to this Registry? Set up the namespace before continuing.
Usage
Usage: Installation
npx shadcn@latest add @neumorphism-ui/field @neumorphism-ui/fieldsetImport
Fieldset import code
"use client";
import * as React from "react";
import { Field, FieldLabel, FieldControl, FieldDescription, FieldError } from "@/components/ui/field";
import { Fieldset, FieldsetLegend } from "@/components/ui/fieldset";Example
Fieldset usage code
export default function Example() {
const [name, setName] = React.useState("Alex");
const nameField = <Field name="displayName"><FieldLabel>{"Display name"}</FieldLabel><FieldControl required value={name} onValueChange={setName} /><FieldDescription>{"Enter the name shown on your profile."}</FieldDescription><FieldError match="valueMissing">{"Enter a name."}</FieldError></Field>;
return (<Fieldset className="w-full max-w-sm"><FieldsetLegend>{"Profile settings"}</FieldsetLegend>{nameField}</Fieldset>);
}API Reference
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
Fieldset | disabled | boolean | — | Disable user interaction. |
FieldsetLegend | children | React.ReactNode | — | Name the group of related fields. |
Fieldset | className | string | function | — | Extend styling, optionally with a state callback. |
Accessibility
- 01
Describe the group with FieldsetLegend and retain labels on individual controls.
- 02
Preserve labels and visible focus when customizing render or className.