Dev Helpers
← Back

Described text field

Import and render <DescribedTextField /> in a React project.

Open this example in the interactive library

Live preview

Source code

// components/DescribedTextField.tsx

import { useId } from "react";

export default function DescribedTextField({
  label = "Display name",
  hint = "Visible to your team",
}: { label?: string; hint?: string } = {}) {
  const id = useId();
  return (
    <label>
      {label}
      <input aria-describedby={id} />
      <small id={id}>{hint}</small>
    </label>
  );
}