Skip to content

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
View the source Spec sheet as Markdown

Install

Install
pnpm dlx shadcn@4.21.1 add @frictionborn/temper-slider

Playground

Palette
Your code
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

PropTypeDefaultWhat it does
valuenumbernoneControlled temperature in °C (clamped to 180-360).
defaultValuenumber250Initial temperature when uncontrolled.
onValueChange(celsius: number) => voidnoneCalled with the new temperature as the knob moves.
labelstring"Tempering temperature in degrees Celsius"Accessible name of the slider.
stepnumber1Step of the range input.
disabledbooleanfalseDisables 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.
pausedbooleanfalseUniversal pause prop: the effect stops drawing; the control keeps working.
maxTiernumber3Hard ceiling on the capability tier.
noncestringnoneCSP nonce for the component's <style> element.
classNamestring""Extra classes on the root.
styleReact.CSSPropertiesnoneInline styles on the root, merged after the palette variables.
refReact.Ref<HTMLDivElement>noneReceives 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.

MeasureResult
Size, gzip3.31 KB at load, 0.02 KB loaded later
Layout shift0.0001
Frames when nothing should moveoff screen 0, hidden tab 0, reduced motion 0
axe accessibility scan0 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.

EnvironmentTierResultDateNotes
Chromium Desktop (SwiftShader)3pass2026-10-2016 passed, 0 failed
Chromium Mobile (Pixel 7 emulation)2pass2026-10-2015 passed, 0 failed
Firefox Desktop3pass2026-10-2014 passed, 0 failed
WebKit Desktop3pass2026-10-2015 passed, 0 failed
WebKit Mobile (iPhone 14 emulation)2pass2026-10-2015 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.

TierWhat it does
T3 FullSame at DPR <= 2
T2 StandardSame at DPR <= 2
T1 LiteSame
T0 StaticThe 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 style attributes, so allow style-src-attr 'unsafe-inline'.

Goes well with