NotchDial

A ticker you drag sideways. Notches slide under a fixed centre mark, the one under it turns accent and tall, and it snaps to the nearest step. A ring fills from zero either way. Inputs.

Open playground

Drag sideways, or focus it and use the arrow keys.

About

NotchDial is a React component in the Inputs category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { NotchDial } from "@ashutoshswamy/smoui" and set value, min, onChange among its 6 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { NotchDial } from "@ashutoshswamy/smoui";

<NotchDial min={-20} max={20} defaultValue={0} onChange={(v) => console.log(v)} />

Props 6

value / defaultValue

Controlled or starting value.

number
min / max / step

Range and step. Default -20, 20, 1.

number
onChange

Fires as the value crosses each notch.

(value: number) => void
showRing

The ring above. Default true.

boolean
format

Readout text. Default signed.

(value: number) => string
label

Accessible name.

string