Air

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/card-air

About this component

An air quality card that answers how far you can see: a city skyline, a lower skyline, hills and two mountain ridges recede under a sky and a sun, and the air between them fills with haze as the reading rises. In clean air the snowy far peaks stay crisp under a deep sky; in smog they vanish one by one into an ochre haze and the sun becomes a dim orange disc. Pick a city and the haze cross-fades as the figure rolls, or drag across the landscape to scrub the pollution.

Triggers

  • Card
  • Ambient
  • State change
  • Click
  • Continuous
  • Gradient

Techniques

  • SVG
  • Filter
  • CSS variables
  • Gradient
  • Radial gradient
  • requestAnimationFrame
  • Keyframes
  • Event position

Difficulty

Advanced

Accessibility

Keyboard and screen readers

The city chips are native buttons with aria-pressed and a polite live region announces the pick, for example "Mirov, AQI 74, Moderate". The landscape is a focusable role="slider" named Haze (0 to 200) with aria-valuetext giving the AQI, the word and how far you can see; the arrow keys step by 5, Page Up and Page Down by 25, Home and End go to the ends. The drawn figure and scene are aria-hidden.

Reduced motion

The haze, figure and colours cut to the new reading, and the drifting band, birds and blinking windows hold still.

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

More cards

See all

4nodes

BlocksGet code
CellGet code

Holding

ClimateGet code
FlapGet code