Skip to content
← Text Input
Edit Text Input
Name
Also known as (comma separated)
Brief definition
Single-line text control.
Notes
Tier
Core
Useful
Reference
Deleted
Controls schema (JSON array)
[ { "id": "label", "type": "text", "label": "Label", "default": "Email address" }, { "id": "placeholder", "type": "text", "label": "Placeholder", "default": "you@example.com" }, { "id": "variant", "type": "select", "label": "Variant", "default": "outline", "options": [ "outline", "filled", "underline" ] }, { "id": "accent", "type": "color", "label": "Focus colour", "default": "#BFD9F2", "presets": [ "#BFD9F2", "#A8E6C1", "#F5C2E0", "#D9C8F0", "#E8A020", "#241430" ] }, { "id": "radius", "type": "number", "label": "Corner radius", "default": 8, "min": 0, "max": 16, "step": 1 }, { "id": "required", "type": "toggle", "label": "Required", "default": false } ]
Templates (JSON object keyed by format)
{ "html": "<label class=\"field\">\n <span class=\"field__label\">{{label}}{{#if required}} <span class=\"field__req\">*</span>{{/if}}</span>\n <input class=\"field__input field__input--{{variant}}\" style=\"--accent:{{accent}};border-radius:{{radius}}px;\" type=\"text\" placeholder=\"{{placeholder}}\"{{#if required}} required{{/if}}>\n</label>\n<style>\n.field { display: block; font: 14px system-ui, sans-serif; color: #241430; max-width: 280px; }\n.field__label { display: block; margin-bottom: 6px; font-weight: 500; }\n.field__req { color: #241430; }\n.field__input { width: 100%; box-sizing: border-box; padding: 10px 12px; font: inherit; color: #241430; background: #FAF7F2; }\n.field__input--outline { border: 1.5px solid #24143040; }\n.field__input--filled { border: 1.5px solid transparent; background: #24143010; }\n.field__input--underline { border: none; border-bottom: 1.5px solid #24143040; border-radius: 0 !important; }\n.field__input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }\n</style>", "tailwind": "<label class=\"block max-w-xs text-sm text-[#241430] font-sans\">\n <span class=\"block mb-1.5 font-medium\">{{label}}{{#if required}} <span>*</span>{{/if}}</span>\n <input type=\"text\" placeholder=\"{{placeholder}}\"{{#if required}} required{{/if}}\n class=\"field-tw field-tw--{{variant}} w-full box-border px-3 py-2.5 bg-[#FAF7F2] border-[1.5px] focus-visible:outline-none\"\n style=\"border-radius:{{radius}}px;border-color:{{accent}};\">\n</label>\n<style>\n.field-tw--filled { background: #24143010 !important; border-color: transparent !important; }\n.field-tw--underline { border: none !important; border-bottom: 1.5px solid {{accent}} !important; border-radius: 0 !important; }\n</style>", "react": "export function TextInput({\n label = \"{{label}}\",\n placeholder = \"{{placeholder}}\",\n variant = \"{{variant}}\",\n accent = \"{{accent}}\",\n radius = {{radius}},\n required = {{required}},\n}) {\n const border = { outline: \"1.5px solid #24143040\", filled: \"1.5px solid transparent\",\n underline: \"none\" }[variant] ?? \"1.5px solid #24143040\";\n return (\n <label style={{ display: \"block\", maxWidth: 280, fontFamily: \"system-ui, sans-serif\", fontSize: 14, color: \"#241430\" }}>\n <span style={{ display: \"block\", marginBottom: 6, fontWeight: 500 }}>\n {label}{required && \" *\"}\n </span>\n <input type=\"text\" placeholder={placeholder} required={required} style={{\n width: \"100%\", boxSizing: \"border-box\", padding: \"10px 12px\", font: \"inherit\",\n color: \"#241430\", background: variant === \"filled\" ? \"#24143010\" : \"#FAF7F2\",\n border, borderRadius: variant === \"underline\" ? 0 : radius,\n borderBottom: variant === \"underline\" ? `1.5px solid ${accent}` : undefined,\n }} />\n </label>\n );\n}" }
Save
History