Error State

Invalid input state.

html

<div class="es">
  <label class="es__label" for="es-1">Email address</label>
  <input class="es__input" id="es-1" type="text" value="steven@" style="--accent:#E8A020;"
    aria-invalid="true" aria-describedby="es-msg-1">
  <p class="es__msg" id="es-msg-1" role="alert">Enter a complete email address.</p>
</div>
<style>
.es { font: 14px system-ui, sans-serif; color: #241430; max-width: 280px; }
.es__label { display: block; margin-bottom: 6px; font-weight: 500; }
.es__input { width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; color: #241430; background: #FAF7F2; border: 1.5px solid #24143040; border-radius: 8px; }
.es__input[aria-invalid="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, #FAF7F2); }
.es__input:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.es__msg { margin: 6px 0 0; font-size: 12px; color: var(--accent); }
</style>

tailwind

<div class="font-sans text-sm text-[#241430] max-w-[280px]">
  <label class="block mb-1.5 font-medium" for="es-tw-1">Email address</label>
  <input id="es-tw-1" type="text" value="steven@" aria-invalid="true" aria-describedby="es-tw-msg-1"
    class="w-full box-border px-3 py-2.5 bg-[#FAF7F2] border-[1.5px] rounded-lg focus-visible:outline-none" style="border-color:#E8A020;">
  <p id="es-tw-msg-1" role="alert" class="mt-1.5 text-xs" style="color:#E8A020;">Enter a complete email address.</p>
</div>

react

export function ErrorState({
  label = "Email address",
  value = "steven@",
  message = "Enter a complete email address.",
  accent = "#E8A020",
  showError = true,
}) {
  return (
    <div style={{ fontFamily: "system-ui, sans-serif", fontSize: 14, color: "#241430", maxWidth: 280 }}>
      <label htmlFor="es-react-1" style={{ display: "block", marginBottom: 6, fontWeight: 500 }}>{label}</label>
      <input id="es-react-1" type="text" defaultValue={value} aria-invalid={showError} aria-describedby={showError ? "es-react-msg-1" : undefined} style={{
        width: "100%", boxSizing: "border-box", padding: "10px 12px", font: "inherit", color: "#241430",
        background: showError ? `color-mix(in srgb, ${accent} 8%, #FAF7F2)` : "#FAF7F2",
        border: `1.5px solid ${showError ? accent : "#24143040"}`, borderRadius: 8,
      }} />
      {showError && <p id="es-react-msg-1" role="alert" style={{ margin: "6px 0 0", fontSize: 12, color: accent }}>{message}</p>}
    </div>
  );
}