Toggle Sidebar B
AppearanceLight & dark mode D

Pulse Heart

Like button whose glyph collapses to a dot, flips colour and springs back past rest while the pill beats and the count rolls.

Default

Click to like and click again to take it back. With the keyboard the state changes without the run.

Dark previewReplay previewOpen in new tab

Customize

Count1204
Icon
Liked
Idle
Pill
Text
Size40px
Corner32px
Duration560ms
Dot Size0.3
Overshoot1.7
Beat3%
Roll350ms

API Reference

PulseHeart

PropTypeDefaultDescription
likedbooleanundefinedControlled state, bound with v-model:liked. Changes from outside land without a run.
defaultLikedbooleanfalseInitial state when uncontrolled.
countnumber0The number shown. A press adds or removes one and rolls one glyph per press. For a multi-digit odometer with places and decimals, use Counter.
showCountbooleantrueShows the count. Off collapses the pill to a circle.
icon'heart' | 'star' | 'thumb''heart'Built-in glyph. Use the icon slot for a custom element.
idleOutlinebooleantrueDraws the idle glyph as an outline. Off draws it as a muted solid.
sizenumber40Glyph size in pixels. Padding, gap and count size derive from it.
cornernumber32Pill corner radius in pixels.
likedColorstring'#ff4d6d'Colour after the flip, and of the hover tint and focus ring.
idleColorstring'#8b8b93'Colour before the flip.
pillColorstring'#232326'Background of the pill that beats under the glyph.
textColorstring'#f5f5f5'Colour of the count.
durationnumber560Length of the whole run in milliseconds. The flip is always at 40% of it.
dotSizenumber0.3How small the glyph gets at the flip, as a fraction of its size.
overshootnumber1.7How far the glyph rebounds past rest on the way back. 0 lands without a rebound.
beatnumber3Percent the pill dips at the flip.
rollDurationnumber350How long the changed glyph of the count takes to roll, in milliseconds.
disabledbooleanfalseDims the button and ignores input.
labelstring'Like'Accessible name. The count is appended to it.
EventDescription
changeEmitted on every press with the new liked state and the new count.
update:likedEmitted alongside change, for v-model:liked.
SlotDescription
iconCustom glyph that replaces the built-in one. It inherits the colour through currentColor.

Accessibility

Keyboard shortcuts and ARIA behavior.

Shortcut Description
Space + EnterToggles the like. The state changes without the run.
  • Rendered as a button with aria-pressed. A visually hidden label announces the name and the count.
  • With prefers-reduced-motion the run is skipped and the count changes without rolling.