# Number stepper

> A number you nudge or type. It counts page length in eighths the way the stripboard does, takes like a slate, and keeps “not counted” apart from zero.

Source: https://kwark.space/designSystem/components/number-stepper

## Usage

### What it is
A stepper is a number field with a minus and a plus. Kwark’s counts what a production counts, in the units it counts in:
- **Page count in eighths.** A scene’s length is *2 3/8 pages*, as on the strip and the call sheet. Each press is one eighth; typing *2 3/8*, *2.375* or *19/8* all store 2.375 and display *2 3/8*.
- **Takes like a slate.** The slate variant is taller, with the word *Take* above the figure, for the camera report and continuity notes during a shoot, where a thumb presses it between setups.
- **Not counted is not zero.** An empty field says *Not counted*. Zero background artists is a decision; an empty field is a gap the 1st AD still has to fill.

### When to use
- Small whole numbers or fixed steps: takes, background artists, eighths, copies of a printed script, the number of days in a block.

### When not to
- Large or free numbers (a budget line, a phone number): a [Text input](https://kwark.space/designSystem/components/text-input.md) with `inputmode`.
- A judged, continuous value: a [Slider](https://kwark.space/designSystem/components/slider.md) fader.
- Fewer than four possible values: a [Segmented control](https://kwark.space/designSystem/components/segmented-control.md).

### Behaviour
- Holding a button repeats after 400ms, then every 80ms.
- At the minimum or maximum the button disables and the hint says why (*The shortest scene is 1/8 of a page*).
- Typing is never blocked mid-entry. The value is checked when the field loses focus; anything that cannot be read stays as typed with an error under it, so the person’s input is not thrown away.

**Do:** *2 3/8 pages*, and an empty *Not counted* field for extras nobody has numbered yet.

**Don't:** *2.375* in a browser spin box, and 0 pre-filled in every count so the schedule cannot tell unknown from none.

## Style

### Anatomy

1. **Box**: 36px (44 on touch), up to 240px, 1px `--k-line`, 6px corners, the input ground of the [Text input](https://kwark.space/designSystem/components/text-input.md).
2. **Buttons**: square, 36px (44 on touch), 14px minus and plus glyphs at stroke 2, divided from the value by 1px lines. Hover `--k-raise`; pressed a step darker; disabled 40%.
3. **Value**: Poppins 600 16px, tabular and lining, right-aligned against the unit; unit in 12px `--k-text-2` (*pages*, *people*).
4. **Slate variant**: 52px tall with 48px buttons and a `--k-line-strong` edge; *Take* above the figure, the figure at `--k-fs-head` (20px).
5. **Focus**: the box edge takes `--k-accent-soft`; buttons get the 2px `--k-focus` ring.
6. **Error**: danger edge and figure; the message under the field with an alert glyph.

### Tokens

| Token | Light | Dark |
|---|---|---|
| `--k-surface` | #ffffff | #1a1a1a |
| `--k-bg` | #f8fafc | #191919 |
| `--k-raise` | #f1f5f9 | #252525 |
| `--k-line` | #e2e8f0 | rgba(255, 255, 255, .1) |
| `--k-line-strong` | var(--k-text-2) | var(--k-text-2) |
| `--k-text` | #0f172a | #e3e3e3 |
| `--k-text-2` | #5b6779 | #9ca3af |
| `--k-accent-soft` | #e8b58b | #e8b58b |
| `--k-danger` | #b4382c | #e0685c |
| `--k-fs-title` | 16px |  |
| `--k-fs-head` | 20px |  |
| `--k-control-md` | 36px |  |
| `--k-tap` | 44px |  |
| `--k-radius-control` | 6px |  |

## Code

### React

Use the HTML below with `kwark.css`. The example shows the markup and styling. Supply any application behavior described on this page.

### HTML and CSS

Works anywhere with `kwark.css`.

```html
<div class="kw-specimen-row">
  <label class="kw-field"><span class="kw-label">Page count</span>
    <span class="kw-stepper"><button class="kw-stepper__btn" type="button" aria-label="One eighth less"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/></svg></button><span class="kw-stepper__value"><input type="text" inputmode="decimal" value="2 3/8" role="spinbutton" aria-valuemin="0.125" aria-valuenow="2.375" aria-valuetext="2 and 3 eighths pages"><span class="kw-stepper__unit">pages</span></span><button class="kw-stepper__btn" type="button" aria-label="One eighth more"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button></span>
    <span class="kw-hint">Counted in eighths, as the stripboard does.</span></label>
  <label class="kw-field"><span class="kw-label">Scene 12 · Shot 3A</span>
    <span class="kw-stepper kw-stepper--slate"><button class="kw-stepper__btn" type="button" aria-label="Previous take"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/></svg></button><span class="kw-stepper__value"><span class="kw-stepper__unit">Take</span><input type="text" inputmode="numeric" value="4" role="spinbutton" aria-valuemin="1" aria-valuenow="4" aria-label="Take"></span><button class="kw-stepper__btn" type="button" aria-label="Next take"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button></span></label>
</div>
<div class="kw-specimen-row">
  <label class="kw-field"><span class="kw-label">Background artists</span>
    <span class="kw-stepper"><button class="kw-stepper__btn" type="button" aria-label="One fewer background artist"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/></svg></button><span class="kw-stepper__value"><input type="text" inputmode="numeric" value="" placeholder="Not counted" role="spinbutton" aria-valuemin="0"><span class="kw-stepper__unit">people</span></span><button class="kw-stepper__btn" type="button" aria-label="One more background artist"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button></span>
    <span class="kw-hint">Empty is not zero: nobody has counted yet.</span></label>
  <label class="kw-field"><span class="kw-label">Page count</span>
    <span class="kw-stepper"><button class="kw-stepper__btn" type="button" aria-label="One eighth less" disabled><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/></svg></button><span class="kw-stepper__value"><input type="text" inputmode="decimal" value="1/8" role="spinbutton" aria-valuemin="0.125" aria-valuenow="0.125" aria-valuetext="1 eighth of a page"><span class="kw-stepper__unit">page</span></span><button class="kw-stepper__btn" type="button" aria-label="One eighth more"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button></span>
    <span class="kw-hint">The shortest scene is 1/8 of a page.</span></label>
  <label class="kw-field"><span class="kw-label">Page count</span>
    <span class="kw-stepper kw-stepper--invalid"><button class="kw-stepper__btn" type="button" aria-label="One eighth less"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14"/></svg></button><span class="kw-stepper__value"><input type="text" inputmode="decimal" value="2.3" role="spinbutton" aria-invalid="true"><span class="kw-stepper__unit">pages</span></span><button class="kw-stepper__btn" type="button" aria-label="One eighth more"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg></button></span>
    <span class="kw-error" role="alert"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 8v4M12 16h.01"/></svg>Use eighths, like 2 3/8 or 2.375.</span></label>
</div>
```

## Accessibility

### Keyboard
| Key | Does |
|---|---|
| Up / Down | One step (one eighth, one take). |
| Page Up / Page Down | One whole page, or ten. |
| Home / End | Minimum and maximum, when there is one. |
| Typing | Free; checked on blur. |

### Roles and names
- The input is `role="spinbutton"` with `aria-valuemin`, `aria-valuemax` and `aria-valuenow`, and `aria-valuetext` in words: *2 and 3 eighths pages*.
- An empty field has no `aria-valuenow`, so it is announced as blank, not as 0.
- Minus and plus are buttons named with their effect and object: *One eighth less*, *Next take*, *One more background artist*. They stay out of the Tab order only if the field itself handles arrow keys; otherwise they are focusable.
- A disabled limit button keeps its reason in the visible hint.
- Use `inputmode="decimal"` or `"numeric"` so phones show a number pad.

## For agents

### Rules

- **Must** keep an empty count distinct from zero, in storage and on screen ("Not counted").
- **Must** display page lengths in eighths (2 3/8) and accept decimals and fractions as input.
- **Never** block typing mid-entry; validate on blur and keep what was typed beside the error.
- **Always** name the minus and plus buttons with their effect and the object they change.
- **Never** use a browser spin box; use `.kw-stepper` with tabular figures.

### AI readiness test

**Task:** Add a page-length field to the scene details panel and a take counter to the camera report.

**Give the agent:** Number stepper, Stripboard strip, Call sheet.

**Constraint:** Page length is in eighths; takes start at 1.

**A reliable answer:**
- Stepper steps by 1/8 and shows 2 3/8
- Accepts 2.375 typed
- Slate variant for Take
- Minus disables at 1/8 with the reason
- aria-valuetext in words
