Quantity Input Focus
A numeric quantity field uses clear focus styling to support product selection.
A numeric quantity field uses clear focus styling to support product selection.
Live Demo
Hover over the element or use Tab to focus.
Source Code
Copy the HTML, CSS or JavaScript you need for your project.
<div class="tbx-1072"><label for="tbx-1072-count">Order quantity</label><div class="tbx-1072__row"><span class="tbx-1072__thumb" aria-hidden="true">◈</span><div><b>Notebook</b><small>Select 1–9 items</small></div><input id="tbx-1072-count" type="number" min="1" max="9" step="1" value="1" aria-label="Purchase quantity"></div><p>Hover or use Tab to highlight the input.</p></div>
.tbx-1072{width:min(295px,100%);font:11px/1.4 system-ui,sans-serif;color:#304e5d}.tbx-1072>label{display:block;font-size:11px;font-weight:800;margin-bottom:10px}.tbx-1072__row{display:flex;align-items:center;gap:10px;padding:15px 12px;border:1px solid #d6e1e8;border-radius:9px;background:#fff;transition:border-color .25s,box-shadow .25s}.tbx-1072__thumb{width:45px;height:45px;flex:0 0 45px;border-radius:8px;background:#e4ede6;color:#699588;display:grid;place-items:center;font-size:25px;transition:transform .25s}.tbx-1072__row>div{display:grid;gap:6px;flex:1;min-width:0}.tbx-1072__row b{font-size:11px}.tbx-1072__row small{font-size:9px;color:#8295a0}.tbx-1072 input{width:57px;min-width:0;padding:8px 3px 8px 8px;text-align:center;background:#f8fbfb;border:1px solid #bfcfd4;color:#2f5668;font-size:13px;font-weight:800;border-radius:6px}.tbx-1072__row:is(:hover,:focus-within){border-color:#5eaaa2;box-shadow:0 0 0 3px #76bcad21}.tbx-1072__row:is(:hover,:focus-within) .tbx-1072__thumb{transform:rotate(8deg)}.tbx-1072 input:focus-visible{outline:3px solid #d4aa77;outline-offset:2px}.tbx-1072 p{font-size:9px;color:#8196a0;margin:11px 0 0}
@media(prefers-reduced-motion:reduce){.tbx-1072__row,.tbx-1072__thumb{transition:none}}
How to Use
Insert the HTML and add the CSS to your stylesheet. Adjust colors and sizes and avoid class conflicts.
Use Case
Useful for ec sections and product detail sections.
Technical Notes
Keep controls usable on touch devices. Test keyboard focus and reduced-motion preferences.
Mobile: Ensure the interactive content remains accessible without hover on touch devices.
Browser: Uses modern CSS. Check behavior in the browsers you support.
Reduced Motion: Check that prefers-reduced-motion is respected.