Labels and constrained inputs
Use familiar controls with explicit constraints and recovery rather than inventing a larger editor.
Adjust the reading size
The shapes of three leaves along one branch.
View markup
<div class="spec-stack">
<div class="spec-fields spec-size-fields">
<div class="ex-field"><label class="ex-label" for="spec-scale">Reading size</label>
<input id="spec-scale" type="range" min="16" max="32" value="20" aria-valuetext="20 pixels"></div>
<div class="ex-field"><label class="ex-label" for="spec-size">Pixels</label>
<input id="spec-size" class="ex-input" type="number" min="16" max="32" value="20"></div></div>
<p class="spec-sample-text" data-sample-text>The shapes of three leaves along one branch.</p>
</div>Filter chips
Let people combine filters and see their selections at a glance.
- Tidal pools
- Market square
- Harbour streets
3 notebooks
View markup
<div class="atlas-stack" data-ex-recipe="filter-chips">
<fieldset class="atlas-fieldset"><legend class="ex-label">Show notebooks about</legend>
<div class="ex-filter-chips"><label class="ex-filter-chip" for="atlas-chip-coast"><input type="checkbox" id="atlas-chip-coast" value="coast"><span><span class="ex-icon ex-icon--check ex-chip-check" aria-hidden="true"></span>Coast</span></label>
<label class="ex-filter-chip" for="atlas-chip-city"><input type="checkbox" id="atlas-chip-city" value="city"><span><span class="ex-icon ex-icon--check ex-chip-check" aria-hidden="true"></span>City</span></label></div></fieldset>
<ul class="atlas-rows"><li data-topic="coast">Tidal pools</li><li data-topic="city">Market square</li><li data-topic="coast city">Harbour streets</li></ul>
<p class="atlas-status" role="status">3 notebooks</p>
</div>Use in a projectUsage and implementation
Full example
Use and alternatives
Use removable labels for a small explicit list and native checkboxes for independent choices. Use native number, range, date and time controls when their semantics fit the product. A text or numeric alternative can make precise range entry easier.
Anatomy
A label-entry field has a visible label, Add action, help, error and ordinary removable items. Each checkbox group has a legend. Range shows a readable value and meaningful aria-valuetext; numeric/date/time fields describe their constraints before submission.
States and recovery
Handle blank, duplicate and invalid labels; zero/one/many selection; minimum/maximum/step failures; valid submission; clearing and retry. Preserve user input after validation. Do not silently clamp an invalid submitted value into a different commitment.
Semantics and focus
Removal moves focus to an adjacent enabled removal action, then a stable entry/fallback when none remain. Native disabled fieldsets retain browser semantics, including the first-legend exception. Error summaries link to the relevant enabled field. Grouped radio choices and independent checkboxes keep their native keyboard models.
Responsive and preferences
Let heading rows and actions wrap before shrinking text. Limit nested gutters at narrow widths; native date year segments can be clipped even when document overflow is zero. Check the actual visible editor with 200% text simulation, spacing, RTL and then real zoom.
API and ownership
addLabel, filterTopics, toggleTopic, validateTopics and the validateDuration/date/time/plan functions serve the fictional example domain. PLAN_RULES are illustrative constraints, not an all-purpose booking engine. An adopter defines permitted ranges, locale, precision, time-zone meaning and server validation.
Security and data
Client validation improves recovery; it does not enforce a server boundary. Treat labels and dates as untrusted inputs and render them as text. Keep date-only values distinct from timestamps; actual scheduling must resolve time-zone and daylight-saving rules.
Acceptance
Exercise invalid→summary→field→valid recovery, duplicate labels, only/first/middle/last removal, hidden checkbox selection and min/max/step boundaries. Confirm the entire native date and time value is editable and visible. Device, assistive-technology and real scheduling acceptance remain separate.
