Heartbeat Checkbox

0 viewshard
Background:
Heartbeat Checkbox
1
2
3
4
5
6
7
8
<label class="heartbeat-container">
  <input type="checkbox" />
  <div class="heartbeat-checkmark">
    <svg viewBox="0 0 24 24">
      <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
    </svg>
  </div>
</label>
Was this helpful?

What is inside Heartbeat Checkbox

Heartbeat Checkbox is a CSS checkbox built with a keyframe animation, transforms, defined in 46 lines across 10 selectors.

18
CSS properties
10
Selectors
46
Lines of CSS
3
Formats

Techniques used

Keyframe animationTransitionsTransformsChecked stateFlexbox

Animation defined: heartbeat

CSS properties in this component

align-itemsanimationbackgroundborderborder-colorborder-radiuscursordisplayfillheightinputjustify-contentopacitypositiontransformtransitionuser-selectwidth

Accessibility check2 to fix

  • Built on a native <label> element, so keyboard focus and screen reader semantics work without extra attributes.
  • No focus style is defined. Add one before shipping, or keyboard users lose track of position.
  • Animates without a prefers-reduced-motion guard. Wrap the animation in that query if motion sensitivity matters to your audience.

These notes are generated by reading this component's own source, so they describe what it actually does rather than what a template says. Copy the code above in HTML, CSS, Tailwind and adapt it freely.