Sleep

7h42m

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/card-sleep

About this component

A sleep card in black: last night as a bar of lime light from bed to wake, deep sleep as darker bands inside it and two REM markers pulsing on its edge, with the total in big digits. Drag the knurled wake knob at the bar's end and the total rolls, the bands stretch or squeeze with it, and a sun climbs out of the card's corner, the sky warming, the later you set the alarm.

Triggers

  • Card
  • Neon
  • Glow
  • Continuous
  • Ambient
  • State change

Techniques

  • CSS variables
  • CSS transition
  • Keyframes
  • Event position
  • Gradient
  • Radial gradient

Difficulty

Intermediate

Accessibility

Keyboard and screen readers

The card is a section labelled Sleep. The wake knob is a native button with role=slider labelled Wake time, aria-valuemin 330 and aria-valuemax 540 in minutes, aria-valuenow and an aria-valuetext in HH:MM; arrow keys step 5 minutes, PageUp and PageDown 30, Home and End go to the limits, and it takes pointer drags with capture. The total is a polite live region; the bar, bands, markers, sun and time row are aria-hidden (the slider reads the time). The knob has a white focus ring.

Reduced motion

Nothing pulses or sweeps and every change is a cut.

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

More cards

See all

SorbetGet code

Walk

4,152steps

StrideGet code
Nova
Receive48
Kite
SwapGet code
TearGet code