Dev Helpers

React / Accessible fields

Required field legend

Dev Helpers · April 15, 2026

A legend can explain what a required marker means. Each required input still needs its own accessible required state.

Worked example

// components/RequiredFieldLegend.tsx

export default function RequiredFieldLegend({
  label = "Display name",
  hint = "Visible to your team",
}: { label?: string; hint?: string } = {}) {
  return (
    <fieldset>
      <legend>{label}</legend>
      <p>{hint}</p>
      <label>
        Value (required)
        <input required />
      </label>
    </fieldset>
  );
}

Implementation notes

Do not rely on a red asterisk alone to convey a requirement. Pair visible instructions with native field semantics.

Try it yourself

Submit the form with one required field blank.

Open the React example →

Editorial date April 15, 2026 · 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.