Helper Text

Supporting input instructions.

Must be at least 8 characters.

html

<div class="ht">
  <label class="ht__label" for="ht-1">Password</label>
  <input class="ht__input" id="ht-1" type="password" placeholder="••••••••" style="--accent:#D9C8F0;" aria-describedby="ht-help-1">
  <p class="ht__helper ht__helper--small" id="ht-help-1">Must be at least 8 characters.</p>
</div>
<style>
.ht { font: 14px system-ui, sans-serif; color: #241430; max-width: 260px; }
.ht__label { display: block; margin-bottom: 6px; font-weight: 500; }
.ht__input { width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; color: #241430; background: #FAF7F2; border: 1.5px solid #24143040; border-radius: 8px; }
.ht__input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.ht__helper { margin: 6px 0 0; color: #24143099; }
.ht__helper--small { font-size: 11px; }
.ht__helper--medium { font-size: 13px; }
</style>

tailwind

<div class="font-sans text-sm text-[#241430] max-w-[260px]">
  <label class="block mb-1.5 font-medium" for="ht-tw-1">Password</label>
  <input id="ht-tw-1" type="password" placeholder="••••••••" aria-describedby="ht-tw-help-1"
    class="w-full box-border px-3 py-2.5 bg-[#FAF7F2] border-[1.5px] border-[#24143040] rounded-lg focus-visible:outline-none" style="border-color:#D9C8F0;">
  <p id="ht-tw-help-1" class="ht-tw-help ht-tw-help--small mt-1.5 text-[#24143099]">Must be at least 8 characters.</p>
</div>
<style>
.ht-tw-help--small { font-size: 11px; }
.ht-tw-help--medium { font-size: 13px; }
</style>

react

export function HelperText({
  label = "Password",
  placeholder = "••••••••",
  helper = "Must be at least 8 characters.",
  accent = "#D9C8F0",
  size = "small",
}) {
  return (
    <div style={{ fontFamily: "system-ui, sans-serif", fontSize: 14, color: "#241430", maxWidth: 260 }}>
      <label htmlFor="ht-react-1" style={{ display: "block", marginBottom: 6, fontWeight: 500 }}>{label}</label>
      <input id="ht-react-1" type="password" placeholder={placeholder} aria-describedby="ht-react-help-1" style={{
        width: "100%", boxSizing: "border-box", padding: "10px 12px", font: "inherit", color: "#241430",
        background: "#FAF7F2", border: `1.5px solid ${accent}`, borderRadius: 8,
      }} />
      <p id="ht-react-help-1" style={{ margin: "6px 0 0", color: "#24143099", fontSize: size === "medium" ? 13 : 11 }}>{helper}</p>
    </div>
  );
}