Examples /
Forms
Text fields with hints and errors, selects, checkboxes, radio cards, switches, sliders, file upload and complete sign-in and settings forms.
Text field
Label, hint and error. The error state comes from the browser: :user-invalid turns the border red only after the user has typed, and the message is shown with :has().
<div class="w-100% xw-360px d-grid g-20px">
<label class="d-grid g-6px">
<span class="fs-14px fw-500 c-slateTheme12">Full name</span>
<input type="text" placeholder="Ada Lovelace" class="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]">
<span class="fs-13px c-slateTheme11">As it appears on your ID.</span>
</label>
<label class="d-grid g-6px --has(--user-invalid)_[data-error]-d-flex">
<span class="fs-14px fw-500 c-slateTheme12">Email</span>
<input type="email" required value="ada@" class="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))] --user-invalid[bc-redTheme8,box-shadow(0_0_0_3px_light-dark(#feebec,#3b1219))]">
<span data-error class="d-none aic g-6px fs-13px c-redTheme11"><svg class="w-14px h-14px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6M9 9l6 6"/></svg>Enter a valid email address.</span>
</label>
</div>export default function TextField() {
return (
<div className="w-100% xw-360px d-grid g-20px">
<label className="d-grid g-6px">
<span className="fs-14px fw-500 c-slateTheme12">Full name</span>
<input type="text" placeholder="Ada Lovelace" className="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]" />
<span className="fs-13px c-slateTheme11">As it appears on your ID.</span>
</label>
<label className="d-grid g-6px --has(--user-invalid)_[data-error]-d-flex">
<span className="fs-14px fw-500 c-slateTheme12">Email</span>
<input type="email" required defaultValue="ada@" className="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))] --user-invalid[bc-redTheme8,box-shadow(0_0_0_3px_light-dark(#feebec,#3b1219))]" />
<span data-error="" className="d-none aic g-6px fs-13px c-redTheme11">
<svg className="w-14px h-14px" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<circle cx="12" cy="12" r="10" />
<path d="m15 9-6 6M9 9l6 6" />
</svg>
Enter a valid email address.
</span>
</label>
</div>
);
}Inputs with icons and add-ons
An icon inside the field, a fixed prefix, and a field joined to a button. The wrapper draws the border, so focus rings wrap the whole group.
<div class="w-100% xw-400px d-grid g-16px">
<label class="d-flex aic g-8px h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme10 --focus-within[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]">
<svg class="w-16px h-16px flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>
<input type="search" placeholder="Search projects" aria-label="Search projects" class="flex-1 mw-0 h-100% b-0 bgc-transparent c-slateTheme12 fs-14px font-family-inherit outline-none --placeholder-c-slateTheme9">
<kbd class="fs-11px c-slateTheme10 b-1px-solid-slateTheme6 br-4px px-5px font-family(ui-monospace,monospace)">⌘K</kbd>
</label>
<label class="d-flex h-38px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 overflow-hidden --focus-within[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]">
<span class="d-flex aic px-12px bgc-slateTheme3 border-right-1px-solid-slateTheme7 fs-14px c-slateTheme11">https://</span>
<input type="text" placeholder="your-site.com" aria-label="Website" class="flex-1 mw-0 px-12px b-0 bgc-transparent c-slateTheme12 fs-14px font-family-inherit outline-none --placeholder-c-slateTheme9">
</label>
<form class="d-flex g-8px">
<input type="email" placeholder="you@example.com" aria-label="Email" class="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]">
<button class="d-inline-flex aic jcc g-8px h-38px px-16px br-8px b-0 bgc-accentRA1000 c-white fs-14px fw-500 font-family-inherit cursor-pointer --hover-bgc-accentRA1100 --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px] flex-shrink-0">Subscribe</button>
</form>
</div>export default function InputAddons() {
return (
<div className="w-100% xw-400px d-grid g-16px">
<label className="d-flex aic g-8px h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme10 --focus-within[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]">
<svg className="w-16px h-16px flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<circle cx="11" cy="11" r="7" />
<path d="m20 20-3.5-3.5" />
</svg>
<input type="search" placeholder="Search projects" aria-label="Search projects" className="flex-1 mw-0 h-100% b-0 bgc-transparent c-slateTheme12 fs-14px font-family-inherit outline-none --placeholder-c-slateTheme9" />
<kbd className="fs-11px c-slateTheme10 b-1px-solid-slateTheme6 br-4px px-5px font-family(ui-monospace,monospace)">⌘K</kbd>
</label>
<label className="d-flex h-38px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 overflow-hidden --focus-within[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]">
<span className="d-flex aic px-12px bgc-slateTheme3 border-right-1px-solid-slateTheme7 fs-14px c-slateTheme11">https://</span>
<input type="text" placeholder="your-site.com" aria-label="Website" className="flex-1 mw-0 px-12px b-0 bgc-transparent c-slateTheme12 fs-14px font-family-inherit outline-none --placeholder-c-slateTheme9" />
</label>
<form className="d-flex g-8px">
<input type="email" placeholder="you@example.com" aria-label="Email" className="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]" />
<button className="d-inline-flex aic jcc g-8px h-38px px-16px br-8px b-0 bgc-accentRA1000 c-white fs-14px fw-500 font-family-inherit cursor-pointer --hover-bgc-accentRA1100 --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px] flex-shrink-0">Subscribe</button>
</form>
</div>
);
}Select and textarea
A native select with its own arrow, and a textarea that grows with its content (field-sizing: content).
<div class="w-100% xw-360px d-grid g-20px">
<label class="d-grid g-6px">
<span class="fs-14px fw-500 c-slateTheme12">Country</span>
<span class="position-relative d-grid">
<select class="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))] appearance-none pr-36px cursor-pointer">
<option>Nepal</option>
<option selected>India</option>
<option>Japan</option>
<option>Germany</option>
</select>
<svg class="position-absolute r-12px t-50% translate-0--50% w-16px h-16px c-slateTheme10 pointer-events-none" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
</span>
</label>
<label class="d-grid g-6px">
<span class="d-flex jcsb fs-14px fw-500 c-slateTheme12">Message <span class="fw-400 c-slateTheme10">Optional</span></span>
<textarea rows="3" placeholder="Tell us about your project" class="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))] h-auto mh-88px py-10px lh-1.5 resize-vertical field-sizing-content"></textarea>
</label>
</div>export default function SelectTextarea() {
return (
<div className="w-100% xw-360px d-grid g-20px">
<label className="d-grid g-6px">
<span className="fs-14px fw-500 c-slateTheme12">Country</span>
<span className="position-relative d-grid">
<select className="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))] appearance-none pr-36px cursor-pointer" defaultValue="India">
<option>Nepal</option>
<option>India</option>
<option>Japan</option>
<option>Germany</option>
</select>
<svg className="position-absolute r-12px t-50% translate-0--50% w-16px h-16px c-slateTheme10 pointer-events-none" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<path d="m6 9 6 6 6-6" />
</svg>
</span>
</label>
<label className="d-grid g-6px">
<span className="d-flex jcsb fs-14px fw-500 c-slateTheme12">
Message
<span className="fw-400 c-slateTheme10">Optional</span>
</span>
<textarea rows="3" placeholder="Tell us about your project" className="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))] h-auto mh-88px py-10px lh-1.5 resize-vertical field-sizing-content" />
</label>
</div>
);
}Checkboxes and radios
Native inputs restyled with appearance: none. The check mark is a mask on ::before, so it takes the text color of the theme.
<div class="d-flex flex-wrap-wrap g-40px">
<fieldset class="m-0 p-0 b-0 d-grid g-12px">
<legend class="mb-12px fs-14px fw-500 c-slateTheme12">Notifications</legend>
<label class="d-flex aic g-10px fs-14px c-slateTheme12 cursor-pointer">
<input type="checkbox" checked class="appearance-none m-0 box-sizing-border-box w-18px h-18px br-5px b-1px-solid-slateTheme8 bgc-slateTheme1 d-grid place-items-center cursor-pointer --checked[bgc-accentRA1000,bc-accentRA1000] --before[cont,w-10px,h-10px,bgc-white,clip-path(polygon(14%_44%,0_65%,50%_100%,100%_16%,80%_0,43%_62%)),scale-0,transition(scale_.12s)] --checked--before-scale-1 --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
Product updates
</label>
<label class="d-flex aic g-10px fs-14px c-slateTheme12 cursor-pointer">
<input type="checkbox" class="appearance-none m-0 box-sizing-border-box w-18px h-18px br-5px b-1px-solid-slateTheme8 bgc-slateTheme1 d-grid place-items-center cursor-pointer --checked[bgc-accentRA1000,bc-accentRA1000] --before[cont,w-10px,h-10px,bgc-white,clip-path(polygon(14%_44%,0_65%,50%_100%,100%_16%,80%_0,43%_62%)),scale-0,transition(scale_.12s)] --checked--before-scale-1 --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
Weekly digest
</label>
<label class="d-flex aic g-10px fs-14px c-slateTheme9 cursor-not-allowed">
<input type="checkbox" disabled class="appearance-none m-0 box-sizing-border-box w-18px h-18px br-5px b-1px-solid-slateTheme6 bgc-slateTheme3">
Security alerts (always on)
</label>
</fieldset>
<fieldset class="m-0 p-0 b-0 d-grid g-12px">
<legend class="mb-12px fs-14px fw-500 c-slateTheme12">Plan</legend>
<label class="d-flex aic g-10px fs-14px c-slateTheme12 cursor-pointer">
<input type="radio" name="plan" checked class="appearance-none m-0 box-sizing-border-box w-18px h-18px br-999px b-1px-solid-slateTheme8 bgc-slateTheme1 cursor-pointer --checked[b-5px-solid-accentRA1000] transition(border-width_.12s) --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
Monthly
</label>
<label class="d-flex aic g-10px fs-14px c-slateTheme12 cursor-pointer">
<input type="radio" name="plan" class="appearance-none m-0 box-sizing-border-box w-18px h-18px br-999px b-1px-solid-slateTheme8 bgc-slateTheme1 cursor-pointer --checked[b-5px-solid-accentRA1000] transition(border-width_.12s) --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
Yearly (save 20%)
</label>
</fieldset>
</div>export default function CheckboxRadio() {
return (
<div className="d-flex flex-wrap-wrap g-40px">
<fieldset className="m-0 p-0 b-0 d-grid g-12px">
<legend className="mb-12px fs-14px fw-500 c-slateTheme12">Notifications</legend>
<label className="d-flex aic g-10px fs-14px c-slateTheme12 cursor-pointer">
<input type="checkbox" defaultChecked className="appearance-none m-0 box-sizing-border-box w-18px h-18px br-5px b-1px-solid-slateTheme8 bgc-slateTheme1 d-grid place-items-center cursor-pointer --checked[bgc-accentRA1000,bc-accentRA1000] --before[cont,w-10px,h-10px,bgc-white,clip-path(polygon(14%_44%,0_65%,50%_100%,100%_16%,80%_0,43%_62%)),scale-0,transition(scale_.12s)] --checked--before-scale-1 --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]" />
Product updates
</label>
<label className="d-flex aic g-10px fs-14px c-slateTheme12 cursor-pointer">
<input type="checkbox" className="appearance-none m-0 box-sizing-border-box w-18px h-18px br-5px b-1px-solid-slateTheme8 bgc-slateTheme1 d-grid place-items-center cursor-pointer --checked[bgc-accentRA1000,bc-accentRA1000] --before[cont,w-10px,h-10px,bgc-white,clip-path(polygon(14%_44%,0_65%,50%_100%,100%_16%,80%_0,43%_62%)),scale-0,transition(scale_.12s)] --checked--before-scale-1 --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]" />
Weekly digest
</label>
<label className="d-flex aic g-10px fs-14px c-slateTheme9 cursor-not-allowed">
<input type="checkbox" disabled className="appearance-none m-0 box-sizing-border-box w-18px h-18px br-5px b-1px-solid-slateTheme6 bgc-slateTheme3" />
Security alerts (always on)
</label>
</fieldset>
<fieldset className="m-0 p-0 b-0 d-grid g-12px">
<legend className="mb-12px fs-14px fw-500 c-slateTheme12">Plan</legend>
<label className="d-flex aic g-10px fs-14px c-slateTheme12 cursor-pointer">
<input type="radio" name="plan" defaultChecked className="appearance-none m-0 box-sizing-border-box w-18px h-18px br-999px b-1px-solid-slateTheme8 bgc-slateTheme1 cursor-pointer --checked[b-5px-solid-accentRA1000] transition(border-width_.12s) --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]" />
Monthly
</label>
<label className="d-flex aic g-10px fs-14px c-slateTheme12 cursor-pointer">
<input type="radio" name="plan" className="appearance-none m-0 box-sizing-border-box w-18px h-18px br-999px b-1px-solid-slateTheme8 bgc-slateTheme1 cursor-pointer --checked[b-5px-solid-accentRA1000] transition(border-width_.12s) --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]" />
Yearly (save 20%)
</label>
</fieldset>
</div>
);
}Radio cards
Large choices with a title and description. The whole card is the label; :has(:checked) gives the selected one its ring.
<fieldset class="m-0 p-0 b-0 w-100% xw-560px d-grid g-12px @sm-gtc-1fr-1fr-1fr">
<legend class="mb-12px fs-14px fw-500 c-slateTheme12">Instance size</legend>
<label class="position-relative d-grid g-4px p-16px br-12px b-1px-solid-slateTheme6 bgc-slateTheme1 cursor-pointer --hover-bc-slateTheme8 --has(--checked)[bc-accentRATheme900,outline-1px-solid-accentRATheme900,outline-offset--2px] --has(--focus-visible)[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
<input type="radio" name="size" value="s" class="position-absolute o-0">
<span class="fs-14px fw-600 c-slateTheme12">Small</span>
<span class="fs-13px c-slateTheme11">2 vCPU · 4 GB</span>
<span class="mt-8px fs-14px fw-500 c-slateTheme12">$12/mo</span>
</label>
<label class="position-relative d-grid g-4px p-16px br-12px b-1px-solid-slateTheme6 bgc-slateTheme1 cursor-pointer --hover-bc-slateTheme8 --has(--checked)[bc-accentRATheme900,outline-1px-solid-accentRATheme900,outline-offset--2px] --has(--focus-visible)[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
<input type="radio" name="size" value="m" checked class="position-absolute o-0">
<span class="fs-14px fw-600 c-slateTheme12">Medium</span>
<span class="fs-13px c-slateTheme11">4 vCPU · 8 GB</span>
<span class="mt-8px fs-14px fw-500 c-slateTheme12">$24/mo</span>
</label>
<label class="position-relative d-grid g-4px p-16px br-12px b-1px-solid-slateTheme6 bgc-slateTheme1 cursor-pointer --hover-bc-slateTheme8 --has(--checked)[bc-accentRATheme900,outline-1px-solid-accentRATheme900,outline-offset--2px] --has(--focus-visible)[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
<input type="radio" name="size" value="l" class="position-absolute o-0">
<span class="fs-14px fw-600 c-slateTheme12">Large</span>
<span class="fs-13px c-slateTheme11">8 vCPU · 16 GB</span>
<span class="mt-8px fs-14px fw-500 c-slateTheme12">$48/mo</span>
</label>
</fieldset>export default function RadioCards() {
return (
<fieldset className="m-0 p-0 b-0 w-100% xw-560px d-grid g-12px @sm-gtc-1fr-1fr-1fr">
<legend className="mb-12px fs-14px fw-500 c-slateTheme12">Instance size</legend>
<label className="position-relative d-grid g-4px p-16px br-12px b-1px-solid-slateTheme6 bgc-slateTheme1 cursor-pointer --hover-bc-slateTheme8 --has(--checked)[bc-accentRATheme900,outline-1px-solid-accentRATheme900,outline-offset--2px] --has(--focus-visible)[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
<input type="radio" name="size" value="s" className="position-absolute o-0" />
<span className="fs-14px fw-600 c-slateTheme12">Small</span>
<span className="fs-13px c-slateTheme11">2 vCPU · 4 GB</span>
<span className="mt-8px fs-14px fw-500 c-slateTheme12">$12/mo</span>
</label>
<label className="position-relative d-grid g-4px p-16px br-12px b-1px-solid-slateTheme6 bgc-slateTheme1 cursor-pointer --hover-bc-slateTheme8 --has(--checked)[bc-accentRATheme900,outline-1px-solid-accentRATheme900,outline-offset--2px] --has(--focus-visible)[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
<input type="radio" name="size" value="m" defaultChecked className="position-absolute o-0" />
<span className="fs-14px fw-600 c-slateTheme12">Medium</span>
<span className="fs-13px c-slateTheme11">4 vCPU · 8 GB</span>
<span className="mt-8px fs-14px fw-500 c-slateTheme12">$24/mo</span>
</label>
<label className="position-relative d-grid g-4px p-16px br-12px b-1px-solid-slateTheme6 bgc-slateTheme1 cursor-pointer --hover-bc-slateTheme8 --has(--checked)[bc-accentRATheme900,outline-1px-solid-accentRATheme900,outline-offset--2px] --has(--focus-visible)[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
<input type="radio" name="size" value="l" className="position-absolute o-0" />
<span className="fs-14px fw-600 c-slateTheme12">Large</span>
<span className="fs-13px c-slateTheme11">8 vCPU · 16 GB</span>
<span className="mt-8px fs-14px fw-500 c-slateTheme12">$48/mo</span>
</label>
</fieldset>
);
}Switch
A checkbox with role="switch". The track is the input itself and the thumb is its ::before, so there is no extra markup.
<div class="w-100% xw-380px d-grid g-4px">
<label class="d-flex aic jcsb g-16px py-12px border-bottom-1px-solid-slateTheme5 cursor-pointer">
<span class="d-grid g-2px"><span class="fs-14px fw-500 c-slateTheme12">Email notifications</span><span class="fs-13px c-slateTheme11">Get a summary every morning.</span></span>
<input type="checkbox" role="switch" checked class="appearance-none m-0 flex-shrink-0 w-40px h-24px p-2px br-999px bgc-slateTheme6 cursor-pointer transition(background-color_.2s) --checked-bgc-accentRA1000 --before[cont,d-block,w-20px,h-20px,br-999px,bgc-white,box-shadow(0_1px_2px_rgb(0_0_0_/_0.3)),transition(translate_.2s)] --checked--before-translate-16px --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
</label>
<label class="d-flex aic jcsb g-16px py-12px border-bottom-1px-solid-slateTheme5 cursor-pointer">
<span class="d-grid g-2px"><span class="fs-14px fw-500 c-slateTheme12">Push notifications</span><span class="fs-13px c-slateTheme11">Mentions and direct messages only.</span></span>
<input type="checkbox" role="switch" class="appearance-none m-0 flex-shrink-0 w-40px h-24px p-2px br-999px bgc-slateTheme6 cursor-pointer transition(background-color_.2s) --checked-bgc-accentRA1000 --before[cont,d-block,w-20px,h-20px,br-999px,bgc-white,box-shadow(0_1px_2px_rgb(0_0_0_/_0.3)),transition(translate_.2s)] --checked--before-translate-16px --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
</label>
</div>export default function Switch() {
return (
<div className="w-100% xw-380px d-grid g-4px">
<label className="d-flex aic jcsb g-16px py-12px border-bottom-1px-solid-slateTheme5 cursor-pointer">
<span className="d-grid g-2px">
<span className="fs-14px fw-500 c-slateTheme12">Email notifications</span>
<span className="fs-13px c-slateTheme11">Get a summary every morning.</span>
</span>
<input type="checkbox" role="switch" defaultChecked className="appearance-none m-0 flex-shrink-0 w-40px h-24px p-2px br-999px bgc-slateTheme6 cursor-pointer transition(background-color_.2s) --checked-bgc-accentRA1000 --before[cont,d-block,w-20px,h-20px,br-999px,bgc-white,box-shadow(0_1px_2px_rgb(0_0_0_/_0.3)),transition(translate_.2s)] --checked--before-translate-16px --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]" />
</label>
<label className="d-flex aic jcsb g-16px py-12px border-bottom-1px-solid-slateTheme5 cursor-pointer">
<span className="d-grid g-2px">
<span className="fs-14px fw-500 c-slateTheme12">Push notifications</span>
<span className="fs-13px c-slateTheme11">Mentions and direct messages only.</span>
</span>
<input type="checkbox" role="switch" className="appearance-none m-0 flex-shrink-0 w-40px h-24px p-2px br-999px bgc-slateTheme6 cursor-pointer transition(background-color_.2s) --checked-bgc-accentRA1000 --before[cont,d-block,w-20px,h-20px,br-999px,bgc-white,box-shadow(0_1px_2px_rgb(0_0_0_/_0.3)),transition(translate_.2s)] --checked--before-translate-16px --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px]" />
</label>
</div>
);
}Range slider
A native range input with a styled track and thumb. Each browser has its own thumb part, so it is written twice.
<label class="w-100% xw-360px d-grid g-10px">
<span class="d-flex jcsb fs-14px fw-500 c-slateTheme12">Volume <output class="fw-400 c-slateTheme11">60%</output></span>
<input type="range" min="0" max="100" value="60" class="w-100% h-6px m-0 appearance-none br-999px bgc-slateTheme5 accent-color-accentRA1000 cursor-pointer --webkit-slider-thumb[appearance-none,w-18px,h-18px,br-999px,bgc-white,b-2px-solid-accentRA1000,box-shadow(0_1px_3px_rgb(0_0_0_/_0.25))] --moz-range-thumb[w-14px,h-14px,br-999px,bgc-white,b-2px-solid-accentRA1000] --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-4px]">
</label>export default function RangeSlider() {
return (
<label className="w-100% xw-360px d-grid g-10px">
<span className="d-flex jcsb fs-14px fw-500 c-slateTheme12">
Volume
<output className="fw-400 c-slateTheme11">60%</output>
</span>
<input type="range" min="0" max="100" defaultValue="60" className="w-100% h-6px m-0 appearance-none br-999px bgc-slateTheme5 accent-color-accentRA1000 cursor-pointer --webkit-slider-thumb[appearance-none,w-18px,h-18px,br-999px,bgc-white,b-2px-solid-accentRA1000,box-shadow(0_1px_3px_rgb(0_0_0_/_0.25))] --moz-range-thumb[w-14px,h-14px,br-999px,bgc-white,b-2px-solid-accentRA1000] --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-4px]" />
</label>
);
}File upload
A drop zone that is really a label for a hidden file input, so clicking and keyboard both open the file picker.
<label class="w-100% xw-420px d-grid justify-items-center g-8px p-28px br-12px b-1px-dashed-slateTheme7 bgc-slateTheme1 ta-center cursor-pointer transition(background-color_.15s,border-color_.15s) --hover[bgc-slateTheme2,bc-accentRATheme800] --has(--focus-visible)[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
<span class="d-grid place-items-center w-40px h-40px br-10px bgc-accentRATheme100 c-accentRATheme1100"><svg class="w-20px h-20px" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12"/></svg></span>
<span class="fs-14px c-slateTheme12"><span class="fw-600 c-accentRATheme1100">Click to upload</span> or drag and drop</span>
<span class="fs-13px c-slateTheme10">PNG, JPG or PDF, up to 10 MB</span>
<input type="file" multiple class="position-absolute w-1px h-1px o-0">
</label>export default function FileUpload() {
return (
<label className="w-100% xw-420px d-grid justify-items-center g-8px p-28px br-12px b-1px-dashed-slateTheme7 bgc-slateTheme1 ta-center cursor-pointer transition(background-color_.15s,border-color_.15s) --hover[bgc-slateTheme2,bc-accentRATheme800] --has(--focus-visible)[outline-2px-solid-accentRATheme1000,outline-offset-2px]">
<span className="d-grid place-items-center w-40px h-40px br-10px bgc-accentRATheme100 c-accentRATheme1100">
<svg className="w-20px h-20px" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12" />
</svg>
</span>
<span className="fs-14px c-slateTheme12">
<span className="fw-600 c-accentRATheme1100">Click to upload</span>
or drag and drop
</span>
<span className="fs-13px c-slateTheme10">PNG, JPG or PDF, up to 10 MB</span>
<input type="file" multiple className="position-absolute w-1px h-1px o-0" />
</label>
);
}Sign-in form
A complete card: social button, divider, fields, remember me and a full-width submit.
<form class="w-100% xw-380px d-grid g-16px p-28px br-16px b-1px-solid-slateTheme5 bgc-slateTheme1 box-shadow(0_1px_2px_rgb(0_0_0_/_0.04),0_8px_24px_-8px_rgb(0_0_0_/_0.12))">
<div class="d-grid g-4px ta-center">
<h2 class="m-0 fs-20px fw-600 c-slateTheme12">Welcome back</h2>
<p class="m-0 fs-14px c-slateTheme11">Sign in to continue to your workspace.</p>
</div>
<button type="button" class="d-inline-flex aic jcc g-8px h-38px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px fw-500 font-family-inherit cursor-pointer --hover-bgc-slateTheme3"><svg class="w-16px h-16px flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.9a3.4 3.4 0 0 0-.9-2.6c3.1-.3 6.4-1.5 6.4-7A5.4 5.4 0 0 0 20 4.8 5 5 0 0 0 19.9 1S18.7.7 16 2.5a13.4 13.4 0 0 0-7 0C6.3.7 5.1 1 5.1 1A5 5 0 0 0 5 4.8a5.4 5.4 0 0 0-1.5 3.7c0 5.5 3.3 6.7 6.4 7A3.4 3.4 0 0 0 9 18.1V22"/></svg>Continue with GitHub</button>
<div class="d-flex aic g-12px fs-12px c-slateTheme10 --before[cont,flex-1,h-1px,bgc-slateTheme5] --after[cont,flex-1,h-1px,bgc-slateTheme5]">or</div>
<label class="d-grid g-6px"><span class="fs-14px fw-500 c-slateTheme12">Email</span><input type="email" autocomplete="email" placeholder="you@example.com" class="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]"></label>
<label class="d-grid g-6px">
<span class="d-flex jcsb fs-14px fw-500 c-slateTheme12">Password <a href="#" class="fw-400 c-accentRATheme1100 td-none --hover-td-underline">Forgot?</a></span>
<input type="password" autocomplete="current-password" class="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]">
</label>
<label class="d-flex aic g-8px fs-14px c-slateTheme11 cursor-pointer"><input type="checkbox" class="m-0 w-16px h-16px accent-color-accentRA1000">Keep me signed in</label>
<button class="d-inline-flex aic jcc g-8px h-38px px-16px br-8px b-0 bgc-accentRA1000 c-white fs-14px fw-500 font-family-inherit cursor-pointer --hover-bgc-accentRA1100 --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px] w-100%">Sign in</button>
<p class="m-0 fs-13px c-slateTheme11 ta-center">No account? <a href="#" class="c-accentRATheme1100 fw-500 td-none --hover-td-underline">Create one</a></p>
</form>export default function SignInForm() {
return (
<form className="w-100% xw-380px d-grid g-16px p-28px br-16px b-1px-solid-slateTheme5 bgc-slateTheme1 box-shadow(0_1px_2px_rgb(0_0_0_/_0.04),0_8px_24px_-8px_rgb(0_0_0_/_0.12))">
<div className="d-grid g-4px ta-center">
<h2 className="m-0 fs-20px fw-600 c-slateTheme12">Welcome back</h2>
<p className="m-0 fs-14px c-slateTheme11">Sign in to continue to your workspace.</p>
</div>
<button type="button" className="d-inline-flex aic jcc g-8px h-38px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px fw-500 font-family-inherit cursor-pointer --hover-bgc-slateTheme3">
<svg className="w-16px h-16px flex-shrink-0" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.9a3.4 3.4 0 0 0-.9-2.6c3.1-.3 6.4-1.5 6.4-7A5.4 5.4 0 0 0 20 4.8 5 5 0 0 0 19.9 1S18.7.7 16 2.5a13.4 13.4 0 0 0-7 0C6.3.7 5.1 1 5.1 1A5 5 0 0 0 5 4.8a5.4 5.4 0 0 0-1.5 3.7c0 5.5 3.3 6.7 6.4 7A3.4 3.4 0 0 0 9 18.1V22" />
</svg>
Continue with GitHub
</button>
<div className="d-flex aic g-12px fs-12px c-slateTheme10 --before[cont,flex-1,h-1px,bgc-slateTheme5] --after[cont,flex-1,h-1px,bgc-slateTheme5]">or</div>
<label className="d-grid g-6px">
<span className="fs-14px fw-500 c-slateTheme12">Email</span>
<input type="email" autoComplete="email" placeholder="you@example.com" className="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]" />
</label>
<label className="d-grid g-6px">
<span className="d-flex jcsb fs-14px fw-500 c-slateTheme12">
Password
<a href="#" className="fw-400 c-accentRATheme1100 td-none --hover-td-underline">Forgot?</a>
</span>
<input type="password" autoComplete="current-password" className="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]" />
</label>
<label className="d-flex aic g-8px fs-14px c-slateTheme11 cursor-pointer">
<input type="checkbox" className="m-0 w-16px h-16px accent-color-accentRA1000" />
Keep me signed in
</label>
<button className="d-inline-flex aic jcc g-8px h-38px px-16px br-8px b-0 bgc-accentRA1000 c-white fs-14px fw-500 font-family-inherit cursor-pointer --hover-bgc-accentRA1100 --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px] w-100%">Sign in</button>
<p className="m-0 fs-13px c-slateTheme11 ta-center">
No account?
<a href="#" className="c-accentRATheme1100 fw-500 td-none --hover-td-underline">Create one</a>
</p>
</form>
);
}Settings section
The two-column settings layout: description on the left, fields on the right. It stacks on small screens.
<form class="xw-760px w-100% mx-auto d-grid g-24px @md-gtc(220px_1fr) @md-g-40px">
<div class="d-grid g-4px align-content-start">
<h3 class="m-0 fs-15px fw-600 c-slateTheme12">Profile</h3>
<p class="m-0 fs-14px lh-1.5 c-slateTheme11">This is shown on your public page and in comments.</p>
</div>
<div class="d-grid g-16px p-20px br-12px b-1px-solid-slateTheme5 bgc-slateTheme1">
<div class="d-flex aic g-16px">
<span class="d-grid place-items-center w-56px h-56px br-999px bgc-accentRATheme200 c-accentRATheme1100 fs-18px fw-600">AL</span>
<button type="button" class="h-32px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-13px font-family-inherit cursor-pointer --hover-bgc-slateTheme3">Change photo</button>
</div>
<div class="d-grid g-16px @sm-gtc-1fr-1fr">
<label class="d-grid g-6px"><span class="fs-14px fw-500 c-slateTheme12">First name</span><input value="Ada" class="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]"></label>
<label class="d-grid g-6px"><span class="fs-14px fw-500 c-slateTheme12">Last name</span><input value="Lovelace" class="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]"></label>
</div>
<label class="d-grid g-6px"><span class="fs-14px fw-500 c-slateTheme12">Bio</span><textarea rows="3" class="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))] h-auto py-10px lh-1.5 resize-vertical">Mathematician. Writing the first program.</textarea></label>
<div class="d-flex jc-flex-end g-8px pt-4px">
<button type="reset" class="h-36px px-14px br-8px b-0 bgc-transparent c-slateTheme11 fs-14px font-family-inherit cursor-pointer --hover-bgc-slateTheme3">Cancel</button>
<button class="d-inline-flex aic jcc g-8px h-38px px-16px br-8px b-0 bgc-accentRA1000 c-white fs-14px fw-500 font-family-inherit cursor-pointer --hover-bgc-accentRA1100 --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px] h-36px">Save</button>
</div>
</div>
</form>export default function SettingsForm() {
return (
<form className="xw-760px w-100% mx-auto d-grid g-24px @md-gtc(220px_1fr) @md-g-40px">
<div className="d-grid g-4px align-content-start">
<h3 className="m-0 fs-15px fw-600 c-slateTheme12">Profile</h3>
<p className="m-0 fs-14px lh-1.5 c-slateTheme11">This is shown on your public page and in comments.</p>
</div>
<div className="d-grid g-16px p-20px br-12px b-1px-solid-slateTheme5 bgc-slateTheme1">
<div className="d-flex aic g-16px">
<span className="d-grid place-items-center w-56px h-56px br-999px bgc-accentRATheme200 c-accentRATheme1100 fs-18px fw-600">AL</span>
<button type="button" className="h-32px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-13px font-family-inherit cursor-pointer --hover-bgc-slateTheme3">Change photo</button>
</div>
<div className="d-grid g-16px @sm-gtc-1fr-1fr">
<label className="d-grid g-6px">
<span className="fs-14px fw-500 c-slateTheme12">First name</span>
<input defaultValue="Ada" className="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]" />
</label>
<label className="d-grid g-6px">
<span className="fs-14px fw-500 c-slateTheme12">Last name</span>
<input defaultValue="Lovelace" className="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))]" />
</label>
</div>
<label className="d-grid g-6px">
<span className="fs-14px fw-500 c-slateTheme12">Bio</span>
<textarea rows="3" className="w-100% h-38px px-12px br-8px b-1px-solid-slateTheme7 bgc-slateTheme1 c-slateTheme12 fs-14px font-family-inherit box-sizing-border-box outline-none transition(border-color_.15s,box-shadow_.15s) --placeholder-c-slateTheme9 --hover-bc-slateTheme8 --focus[bc-accentRATheme900,box-shadow(0_0_0_3px_light-dark(#e0e7ff,#312e81))] h-auto py-10px lh-1.5 resize-vertical" defaultValue="Mathematician. Writing the first program." />
</label>
<div className="d-flex jc-flex-end g-8px pt-4px">
<button type="reset" className="h-36px px-14px br-8px b-0 bgc-transparent c-slateTheme11 fs-14px font-family-inherit cursor-pointer --hover-bgc-slateTheme3">Cancel</button>
<button className="d-inline-flex aic jcc g-8px h-38px px-16px br-8px b-0 bgc-accentRA1000 c-white fs-14px fw-500 font-family-inherit cursor-pointer --hover-bgc-accentRA1100 --focus-visible[outline-2px-solid-accentRATheme1000,outline-offset-2px] h-36px">Save</button>
</div>
</div>
</form>
);
}