Dev Helpers

React / Content composition

Named field group

Dev Helpers · December 31, 2025

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

Related articles

Percentage meter

A percentage meter needs both a bounded visual fill and a meaningful textual value. Handle a zero denominator before dividing.

Vertical typesetting sample

Vertical typesetting changes the reading direction and available inline space. Treat the sample text as content so it remains selectable and accessible.

Square cover crop

A square image crop gives a card grid consistent geometry. The crop anchor determines whether the most important part of a photo survives.