Skip to content
← Valid
Edit Valid
Name
Also known as (comma separated)
Brief definition
Input passes validation.
Notes
Tier
Core
Useful
Reference
Deleted
Controls schema (JSON array)
[ { "id": "fieldLabel", "type": "text", "label": "Field label", "default": "Email address" }, { "id": "value", "type": "text", "label": "Value", "default": "name@example.com" }, { "id": "accent", "type": "color", "label": "Accent", "default": "#A8E6C1", "presets": [ "#A8E6C1", "#F5C2E0", "#BFD9F2", "#D9C8F0", "#E8A020", "#241430" ] }, { "id": "showIcon", "type": "toggle", "label": "Show check icon", "default": true } ]
Templates (JSON object keyed by format)
{ "html": "<label class=\"vld\" style=\"--accent:{{accent}};\">\n <span class=\"vld__label\">{{fieldLabel}}</span>\n <span class=\"vld__row\">\n <input class=\"vld__input\" type=\"email\" value=\"{{value}}\" required>\n {{#if showIcon}}<svg class=\"vld__icon\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"9\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"/><path d=\"m8 12.5 2.5 2.5L16 9\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"none\"/></svg>{{/if}}\n </span>\n <span class=\"vld__msg\">Real <code>:valid</code> pseudo-class — the browser applies it because this value satisfies <code>type=\"email\"</code> natively.</span>\n</label>\n<style>\n.vld { display: block; width: 280px; box-sizing: border-box; font: 14px/1.5 system-ui, sans-serif; color: #241430; background: #FAF7F2; padding: 16px 18px; border-radius: 12px; }\n.vld__label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 600; color: #241430aa; }\n.vld__row { position: relative; display: block; }\n.vld__input { width: 100%; box-sizing: border-box; font: 14px system-ui, sans-serif; padding: 9px 34px 9px 11px; border-radius: 8px; border: 1.5px solid #24143030; }\n.vld__input:valid { border-color: var(--accent); }\n.vld__icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--accent); display: none; }\n.vld__input:valid ~ .vld__icon { display: block; }\n.vld__msg { display: block; margin-top: 7px; font-size: 11px; color: #241430888; }\n.vld__msg code { background: #24143012; padding: 1px 5px; border-radius: 4px; }\n</style>", "tailwind": "<label class=\"block w-[280px] box-border font-sans text-sm text-[#241430] bg-[#FAF7F2] px-[18px] py-4 rounded-xl\">\n <span class=\"block mb-1.5 text-xs font-semibold text-[#241430]/65\">{{fieldLabel}}</span>\n <span class=\"vld-tw-row relative block\">\n <input type=\"email\" value=\"{{value}}\" required class=\"vld-tw-input w-full box-border text-sm pl-2.5 pr-[34px] py-2 rounded-lg border-[1.5px] border-[#24143030]\">\n {{#if showIcon}}<svg class=\"vld-tw-icon absolute right-2.5 top-1/2 -translate-y-1/2 hidden\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" style=\"color:{{accent}}\"><circle cx=\"12\" cy=\"12\" r=\"9\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"/><path d=\"m8 12.5 2.5 2.5L16 9\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"none\"/></svg>{{/if}}\n </span>\n <span class=\"block mt-1.5 text-[11px] text-[#241430]/55\">Real <code class=\"bg-[#24143012] px-1.5 py-0.5 rounded\">:valid</code> pseudo-class — the browser applies it because this value satisfies <code class=\"bg-[#24143012] px-1.5 py-0.5 rounded\">type=\"email\"</code> natively.</span>\n</label>\n<style>\n.vld-tw-input:valid { border-color: {{accent}}; }\n.vld-tw-input:valid ~ .vld-tw-icon { display: block; }\n</style>", "react": "export function ValidState({\n fieldLabel = \"{{fieldLabel}}\",\n value = \"{{value}}\",\n accent = \"{{accent}}\",\n showIcon = {{showIcon}},\n}) {\n return (\n <label style={{ display: \"block\", width: 280, boxSizing: \"border-box\", font: \"14px/1.5 system-ui, sans-serif\", color: \"#241430\", background: \"#FAF7F2\", padding: \"16px 18px\", borderRadius: 12 }}>\n <span style={{ display: \"block\", marginBottom: 7, fontSize: 12, fontWeight: 600, color: \"#241430aa\" }}>{fieldLabel}</span>\n <span style={{ position: \"relative\", display: \"block\" }}>\n <input type=\"email\" defaultValue={value} required\n style={{ width: \"100%\", boxSizing: \"border-box\", font: \"14px system-ui, sans-serif\", padding: \"9px 34px 9px 11px\", borderRadius: 8, border: `1.5px solid ${accent}` }} />\n {showIcon && (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" style={{ position: \"absolute\", right: 10, top: \"50%\", transform: \"translateY(-50%)\", color: accent }}>\n <circle cx=\"12\" cy=\"12\" r=\"9\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" /><path d=\"m8 12.5 2.5 2.5L16 9\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" fill=\"none\" />\n </svg>\n )}\n </span>\n <span style={{ display: \"block\", marginTop: 7, fontSize: 11, color: \"#241430888\" }}>Real <code>:valid</code> pseudo-class — the browser applies it natively because this value satisfies <code>type=\"email\"</code>.</span>\n </label>\n );\n}" }
Save
History