Weigh

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/card-weigh

About this component

A weight log card: a ruler whose line bends toward the knob as if the knob were a magnet, the ticks leaning with it, and a yellow light pooled round the knob. Drag the knob or use the arrow keys and the big reading rolls, the bend following the knob up and down the scale. Switch lb to kg and the ruler re-marks itself while the figure converts; Save stamps the entry with a tick.

Triggers

  • Card
  • Glow
  • Mouse tracking
  • State change
  • Click
  • Draw

Techniques

  • SVG
  • CSS variables
  • Event position
  • CSS transition
  • Radial gradient

Difficulty

Advanced

Accessibility

Keyboard and screen readers

The ruler is a role='slider' labelled Weight with aria-valuenow in pounds and an aria-valuetext in the chosen unit; arrow keys step 1, Page keys 5, Home and End jump; the unit keys expose aria-pressed and Save's label becomes Saved.

Reduced motion

Reduced motion removes the thumb and button transitions; the bend itself is drawn per value and needs none.

Use it in anything you build, commercial and client work included. Licence

More cards

See all
ZonesGet code

Design review

Live
  • Mina, speaking
  • Omar
  • Leo
  • Ama
  • Noor
8
HuddleGet code

Mira Holt

Art director

TeamGet code

Field recordings

412files

AlbumGet code