Compact Heart Checkbox
0 viewseasy
Background:
1
2
3
4
5
6
7
8
<label class="compact-heart-container">
<input type="checkbox" />
<div class="compact-heart-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>Compact Heart Checkbox
0 viewseasy
Background:
Compact Heart Checkbox
1
2
3
4
5
6
7
8
<label class="compact-heart-container">
<input type="checkbox" />
<div class="compact-heart-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 Compact Heart Checkbox
Compact Heart Checkbox is a CSS checkbox built with transforms, defined in 39 lines across 6 selectors.
17
CSS properties
6
Selectors
39
Lines of CSS
3
Formats
Techniques used
TransitionsTransformsChecked stateFlexbox
CSS properties in this component
align-itemsbackgroundborderborder-colorborder-radiuscursordisplayfillheightinputjustify-contentopacitypositiontransformtransitionuser-selectwidthAccessibility check1 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.
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.