Botón de “me gusta” o favorito con una pulsación táctil: el glifo se hunde bajo el puntero y luego rebota por encima de su tamaño completo mientras se rellena, al tiempo que un anillo y una corona de chispas irradian una vez; los dígitos del contador que cambian ruedan hacia arriba o hacia abajo en casillas fijas, formateados con Intl.
Categoría
Microinteracciones
Tipo
Web Component (<mv-like>)
Estado
estable
Keywords
like, heart, favorite, star, wishlist, upvote, toggle, burst, counter, social
When to use
Posts, comments or products need a like, favorite or upvote toggle with a live counter
A product grid or detail page needs a compact icon-only wishlist heart
A social feed wants expressive feedback when a user hearts or stars an item
Avoid when
Users should give a graded score rather than a binary like → use Rating instead
The toggle is a neutral setting such as bold or mute in a toolbar → use Toggle instead
Agente de IA con el servidor MCP de Marvelous UI: install_components({ slugs: ["like-button"], target_dir: "<absolute path>/src/marvelous", framework: "react" }).
Liked (reflected as aria-pressed on the inner button).
count
number
Displayed counter (omitted = icon-only button). Steps by one on each toggle and never goes below 0.
label
string
Like (star: Favorite)
Accessible name; the formatted counter is appended: “Like (2,381)”.
icon
heart | star
heart
Glyph.
locale
BCP 47
en-US
Number formatting of the counter (Intl.NumberFormat).
disabled
boolean
Disables the button.
data-variant
outline
Outlined pill on a solid background.
data-size
lg
Larger.
Properties
Name
Tipo
Description
strings
Partial<{ like, favorite }>
Default accessible names for the heart and star when label is not set. English defaults.
Methods
Name
Description
toggle(force?)
Toggles like a click: plays the feedback, steps the counter, emits mv-change. Setting pressed or count directly updates silently.
Events
Name
Description
mv-change
After a toggle; detail = { pressed, count } (count is null without a counter).
CSS classes
Name
Description
mv-like-button
The generated <button> (data-icon-only without a counter); hosts may resize or restyle it.
mv-like-icon / -glyph / -ring / -burst / -count
Generated parts (all aria-hidden).
CSS variables
Name
Default
Description
--mv-like-color
rose (star: gold)
Liked color: fill, ring, long sparks and pressed tint.
--mv-like-spark-color
amber (star: copper)
Color of the short sparks.
Accessibility
A real toggle <button> with aria-pressed; its accessible name carries the formatted counter (Intl, en-US by default). The glyph, ring, sparks and visual counter are aria-hidden and ignore the pointer. Setting pressed or count programmatically updates the state without replaying the burst. Reduced motion: no press sink, pop, burst or digit roll, only the fill, color and number change. Forced colors: system colors (ButtonText, Highlight) draw the outline and the liked fill; the burst is hidden.