Botão de curtir ou favoritar com um clique tátil: o glifo afunda sob o ponteiro e depois passa do tamanho cheio ao se preencher, enquanto um anel e uma coroa de faíscas se irradiam uma vez; os dígitos do contador que mudam rolam para cima ou para baixo em posições fixas, formatados com Intl.
Categoria
Microinterações
Tipo
Web Component (<mv-like>)
Status
estável
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 com o servidor MCP do 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.