A fieldset and legend establish a name for a group of related inputs. This context matters when several controls share short labels.
Worked example
// components/NamedFieldGroup.tsx
import type { ReactNode } from "react";
export default function NamedFieldGroup({
heading = "Workshop",
children = "Details are available at the front desk.",
}: { heading?: string; children?: ReactNode } = {}) {
return (
<fieldset>
<legend>{heading}</legend>
{children}
</fieldset>
);
}Implementation notes
A group label complements individual labels. It cannot replace the name of each choice or text field.
Try it yourself
Read the fields after removing their surrounding page heading.
Open the React example →Editorial date December 31, 2025 · Published December 6, 2026