Shows a required field.
<label class="ri" for="ri-1">
<span class="ri__label">
Postcode
<span class="ri__mark ri__mark--asterisk" style="--accent:#E8A020;" aria-hidden="true"></span><span class="ri__sr">, required</span>
</span>
<input class="ri__input" id="ri-1" type="text" required>
</label>
<style>
.ri { display: block; font: 14px system-ui, sans-serif; color: #241430; max-width: 220px; }
.ri__label { display: block; margin-bottom: 6px; font-weight: 500; }
.ri__mark { color: var(--accent); font-weight: 700; }
.ri__mark--asterisk::before { content: " *"; }
.ri__mark--text::before { content: " (required)"; font-size: 11px; font-weight: 600; }
.ri__mark--dot::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 6px; }
.ri__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ri__input { width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; color: #241430; background: #FAF7F2; border: 1.5px solid #24143040; border-radius: 8px; }
.ri__input:focus-visible { outline: none; border-color: #241430; }
</style><label class="block max-w-[220px] font-sans text-sm text-[#241430]" for="ri-tw-1">
<span class="block mb-1.5 font-medium">
Postcode
<span class="ri-tw-mark ri-tw-mark--asterisk" style="color:#E8A020;" aria-hidden="true"></span><span class="sr-only">, required</span>
</span>
<input id="ri-tw-1" type="text" required class="w-full box-border px-3 py-2.5 bg-[#FAF7F2] border-[1.5px] border-[#24143040] rounded-lg focus-visible:outline-none focus-visible:border-[#241430]">
</label>
<style>
.ri-tw-mark--asterisk::before { content: " *"; font-weight: 700; }
.ri-tw-mark--text::before { content: " (required)"; font-size: 11px; font-weight: 600; }
.ri-tw-mark--dot::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-left: 6px; }
</style>export function RequiredIndicator({
label = "Postcode",
style = "asterisk",
required = true,
accent = "#E8A020",
}) {
const marks = { asterisk: " *", text: " (required)", dot: "" };
return (
<label style={{ display: "block", maxWidth: 220, fontFamily: "system-ui, sans-serif", fontSize: 14, color: "#241430" }}>
<span style={{ display: "block", marginBottom: 6, fontWeight: 500 }}>
{label}
{required && (
<span style={{ color: accent, fontWeight: 700, fontSize: style === "text" ? 11 : undefined }}>
{style === "dot"
? <span style={{ display: "inline-block", width: 6, height: 6, borderRadius: "50%", background: accent, marginLeft: 6 }} />
: marks[style]}
</span>
)}
</span>
<input type="text" required={required} style={{
width: "100%", boxSizing: "border-box", padding: "10px 12px", font: "inherit", color: "#241430",
background: "#FAF7F2", border: "1.5px solid #24143040", borderRadius: 8,
}} />
</label>
);
}