Success State

Valid input state.

✓ Looks good!

html

<div class="ss">
  <label class="ss__label" for="ss-1">Email address</label>
  <input class="ss__input" id="ss-1" type="text" value="steven@example.com" style="--accent:#A8E6C1;"
    aria-invalid="false" aria-describedby="ss-msg-1">
  <p class="ss__msg" id="ss-msg-1">&#10003; Looks good!</p>
</div>
<style>
.ss { font: 14px system-ui, sans-serif; color: #241430; max-width: 280px; }
.ss__label { display: block; margin-bottom: 6px; font-weight: 500; }
.ss__input { width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; color: #241430; background: #FAF7F2; border: 1.5px solid #24143040; border-radius: 8px; }
.ss__input[aria-describedby] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, #FAF7F2); }
.ss__input:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.ss__msg { margin: 6px 0 0; font-size: 12px; color: #241430; font-weight: 600; }
</style>

tailwind

<div class="font-sans text-sm text-[#241430] max-w-[280px]">
  <label class="block mb-1.5 font-medium" for="ss-tw-1">Email address</label>
  <input id="ss-tw-1" type="text" value="steven@example.com" aria-invalid="false" aria-describedby="ss-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:#A8E6C1;">
  <p id="ss-tw-msg-1" class="mt-1.5 text-xs font-semibold">&#10003; Looks good!</p>
</div>

react

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