control · Canvas 2D
TemperSlider
A real slider across polished steel that shows the colour steel takes at each temperature.
Native range input across polished steel; the knob shows the oxide colour that forms at that temperature
- Canvas 2D
- Reduced motion: still-frame
- 3.31 KB gzip
- Layout shift 0.0001
Install
pnpm dlx shadcn@4.21.1 add @frictionborn/temper-slider
Playground
import { TemperSlider } from "@/components/ui/temper-slider";
<TemperSlider />In a full example
The full example loads as you scroll to it.
Accessibility
- A native <input type=range> with an accessible name and aria-valuetext ("250 degrees, Bronze"). Before the canvas mounts the input is visible; after, it sits transparent over the drawing. The oxide name is lightened only as needed to reach 4.5:1.
- Keyboard: Native range keys: arrows, PageUp/PageDown, Home, End; the knob outline turns hot when focused
- Touch: Drag
- WCAG criteria it is built for: 1.3.1, 1.4.3, 2.1.1, 2.4.7, 4.1.2
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
value | number | none | Controlled temperature in °C (clamped to 180-360). |
defaultValue | number | 250 | Initial temperature when uncontrolled. |
onValueChange | (celsius: number) => void | none | Called with the new temperature as the knob moves. |
label | string | "Tempering temperature in degrees Celsius" | Accessible name of the slider. |
step | number | 1 | Step of the range input. |
disabled | boolean | false | Disables the input. |
palette | "fire" | "ice" | "neon" | "mono" | "custom" | "fire" | Colours of the effect (DESIGN.md A8). custom reads --fb-heat-0..4 from the page. |
paused | boolean | false | Universal pause prop: the effect stops drawing; the control keeps working. |
maxTier | number | 3 | Hard ceiling on the capability tier. |
nonce | string | none | CSP nonce for the component's <style> element. |
className | string | "" | Extra classes on the root. |
style | React.CSSProperties | none | Inline styles on the root, merged after the palette variables. |
ref | React.Ref<HTMLDivElement> | none | Receives the root element. |
Measured on the bench
Measured by the automated bench at commit 538b855 on 2026-10-20. These numbers are written by the bench, never by hand.
| Measure | Result |
|---|---|
| Size, gzip | 3.31 KB at load, 0.02 KB loaded later |
| Layout shift | 0.0001 |
| Frames when nothing should move | off screen 0, hidden tab 0, reduced motion 0 |
| axe accessibility scan | 0 serious, 0 critical |
Browsers it ran in
Automated Playwright runs, some with device emulation. Results from physical phones and tablets are still pending, so none are listed.
| Environment | Tier | Result | Date | Notes |
|---|---|---|---|---|
| Chromium Desktop (SwiftShader) | 3 | pass | 2026-10-20 | 16 passed, 0 failed |
| Chromium Mobile (Pixel 7 emulation) | 2 | pass | 2026-10-20 | 15 passed, 0 failed |
| Firefox Desktop | 3 | pass | 2026-10-20 | 14 passed, 0 failed |
| WebKit Desktop | 3 | pass | 2026-10-20 | 15 passed, 0 failed |
| WebKit Mobile (iPhone 14 emulation) | 2 | pass | 2026-10-20 | 15 passed, 0 failed |
On different devices
Reduced motion (still-frame): The steel and the knob are drawn once per change, as at every tier; nothing animates.
| Tier | What it does |
|---|---|
| T3 Full | Same at DPR <= 2 |
| T2 Standard | Same at DPR <= 2 |
| T1 Lite | Same |
| T0 Static | The same drawing: nothing moves on its own, so every tier draws one frame per change |
Content Security Policy
- Works without
'unsafe-eval'. - Needs no reveal gate.
- Sets inline
styleattributes, so allowstyle-src-attr 'unsafe-inline'.