A quantity with steppers and a unit select that rescales the page as a plain GET with no script.
<form class="cap-scale-control cap-field-row" id="sc-units" method="get" action="./states.html" aria-label="Scale this recipe">
<div class="cap-field">
<label class="cap-field-label" for="sc-servings">Servings</label>
<div class="cap-input-group">
<div class="cap-input-addon" data-align="inline-start">
<button type="button" class="cap-btn" data-size="xs" data-variant="quiet" data-icon-only data-cap-part="step-down" tabindex="-1" aria-label="Decrease servings" hidden>−</button>
</div>
<input class="cap-input" id="sc-servings" name="servings" type="number" min="1" max="1000" step="1" value="4" />
<div class="cap-input-addon" data-align="inline-end">
<button type="button" class="cap-btn" data-size="xs" data-variant="quiet" data-icon-only data-cap-part="step-up" tabindex="-1" aria-label="Increase servings" hidden>+</button>
</div>
</div>
</div>
<div class="cap-field">
<label class="cap-field-label" for="sc-system">Units</label>
<div class="cap-select-wrap" data-cap="select">
<select class="cap-select" id="sc-system" name="units">
<option value="" selected>As written</option>
<option value="metric">Metric</option>
<option value="us">US customary</option>
</select>
</div>
</div>
<button type="submit" class="cap-btn" data-variant="secondary">Show</button>
</form>
Copy
View code
Installation
HTML and CSS React
// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/scale-control.css";Copy
import "capsomer/tokens.css";
import "capsomer/scale-control.css";
import { ScaleControl } from "capsomer/react/scale-control";Copy
Usage
<form class="cap-scale-control cap-field-row" method="get" action="/recipes/bread" aria-label="Scale this recipe">
<div class="cap-field">
<label class="cap-field-label" for="servings">Servings</label>
<div class="cap-input-group">
<div class="cap-input-addon" data-align="inline-start"><button type="button" class="cap-btn" data-size="xs" data-variant="quiet" data-icon-only data-cap-part="step-down" tabindex="-1" aria-label="Decrease servings" hidden>−</button></div>
<input class="cap-input" id="servings" name="servings" type="number" min="1" max="1000" step="1" value="4" />
<div class="cap-input-addon" data-align="inline-end"><button type="button" class="cap-btn" data-size="xs" data-variant="quiet" data-icon-only data-cap-part="step-up" tabindex="-1" aria-label="Increase servings" hidden>+</button></div>
</div>
</div>
<div class="cap-field">
<label class="cap-field-label" for="units">Units</label>
<div class="cap-select-wrap" data-cap="select">
<select class="cap-select" id="units" name="units"><option value="" selected>As written</option><option value="metric">Metric</option></select>
</div>
</div>
<button type="submit" class="cap-btn" data-variant="secondary">Show</button>
</form>Copy
import { ScaleControl } from "capsomer/react/scale-control";
<ScaleControl action="/recipes/bread" label="Servings" name="servings" value={4} submitLabel="Show"
units={{ label: "Units", name: "units", value: "", options: [{ value: "", label: "As written" }, { value: "metric", label: "Metric" }] }} />Copy
Examples
A count alone, at its least
<form class="cap-scale-control cap-field-row" id="sc-count" method="get" action="./states.html" aria-label="Scale the print run">
<div class="cap-field">
<label class="cap-field-label" for="sc-copies">Copies</label>
<div class="cap-input-group">
<div class="cap-input-addon" data-align="inline-start">
<button type="button" class="cap-btn" data-size="xs" data-variant="quiet" data-icon-only data-cap-part="step-down" tabindex="-1" aria-label="Decrease copies" hidden>−</button>
</div>
<input class="cap-input" id="sc-copies" name="n" type="number" min="1" max="1000" step="1" value="1" />
<div class="cap-input-addon" data-align="inline-end">
<button type="button" class="cap-btn" data-size="xs" data-variant="quiet" data-icon-only data-cap-part="step-up" tabindex="-1" aria-label="Increase copies" hidden>+</button>
</div>
</div>
</div>
<button type="submit" class="cap-btn" data-variant="secondary">Scale</button>
</form>
Copy
View code
API reference
ScaleControl Prop Type Required Does actionstringYes The page that answers the GET: usually the page the control sits on. labelstringYes The quantity's label ("Servings", "Tubes") and its query name ("servings", "n"). namestringYes valuenumberYes minnumbermaxnumberstepnumber | "any""any" for a quantity that need not be whole (1.5 servings); the steppers still step by 1. units{ label: string; name: string; options: SelectOption[]; value: string }The unit or system select, when there is one: its label, query name, options and value. submitLabelstringThe button's word: "Show", "Scale". Default: "Scale". formLabelstringNames the form, when the page has more than one ("Scale this recipe"). childrenReactNode
Parts and data attributes Class Is .cap-scale-controlthe root
Accessibility
Key Does Tab Moves to the quantity, the unit select and the button Up or Down arrow in the quantity One step up or down Page Up, Page Down, Home, End in the quantity Ten steps, the least, the most Enter in the quantity, or the button Loads the page at the new scale
Each control has a visible label; the steppers are named for the quantity ("Increase servings") and disabled at its bounds. Name the form (aria-label, React formLabel) when the page has more than one form. Screen readers: no manual NVDA or VoiceOver run, by decision (2026-11-07); the automated browser checks and a front-end review stand in. Automated: see the site's Tests page.