Health Bar

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/button-health-bar

About this component

A game-style HP bar embedded in the button body. On hover, the bar drains from 100% to 28% over 800ms with a CSS width transition; the bar dims from bright to light gray to dark gray as HP drops. HP values and a status label update accordingly.

Triggers

  • Hover
  • State change

Techniques

  • CSS transition

Difficulty

Beginner

Accessibility

Reduced motion

Width and colour transitions disabled under prefers-reduced-motion.

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

More buttons

See all
Ink StampGet code
Jello WobbleGet code