Skip to content

Social Action

Free

A pill toggle for like, save, repost, or follow. On a press a jelly disc blooms into a ring, confetti flies out, and the count rolls up.

  • Base UI
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 21, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Compose the action from its icon and its count, and give it a name.

The sample also uses Animated Bookmark Icon and Animated Heart Icon. One command adds them with this item:

post-actions.tsx

SocialAction

<button>
PropTypeDefaultDescription
color"amber""blue""green""rose""rose"
size"default""lg""sm""xl""default"
variant"ghost""outline""soft""soft"
classNamestring—
From Base UIToggleBase UI docs
pressedboolean—Whether the toggle button is currently pressed. This is the controlled counterpart of defaultPressed.
defaultPressedbooleanfalseWhether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed.
disabledbooleanfalseWhether the component should ignore user interaction.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

SocialActionIcon

<span>
PropTypeDefaultDescription
renderRequired—The icon. An element gets checked (the pressed state) and aria-hidden, so an animated icon plays on its own: <AnimatedHeartIcon burst={false} />. A function gets the props and { pressed } for any other icon.
effect"bloom""firework""none""bloom"What plays on a press to on: bloom (default: a jelly disc that hollows into a ring, and 7 spokes of confetti), firework (a fountain of 12 drops that falls with gravity), or none (only the icon pop). A press to off fades a playing effect out.
...props<span> attributes—Every other attribute goes to the <span>, with a ref.

SocialActionCount

<div>
PropTypeDefaultDescription
localestring—The BCP 47 locale of the digits and marks ("de-DE"). Default: the DisplayLocaleProvider locale, else "en-US" (useDisplayLocale). Never the browser language, so a server render and the first browser render write the same number.
formatNumberFormatOptions—The options of Intl.NumberFormat: style (currency, percent, unit), notation (compact), the fraction digits, signDisplay, numberingSystem, and the others. Its parts (formatToParts) decide the columns: each digit rolls, each other part fades.
trend"auto""down""shortest""up"—The direction of each roll. auto (the default) takes it from the value: a bigger value rolls up (the new digit comes in from below), a smaller one rolls down. shortest turns each column the short way round on its own (a clock or a slot machine look).
snap"always""fast""never"—When a change shows the new digits at once, with no roll and no fade. never (the default) rolls each change. fast jumps while the value changes fast (a new value less than one roll after the last, as a pointer that scrubs a chart sends), and rolls again on the first change after a pause. always never rolls.
countRequirednumber—The count without this person's action: the part shows count + 1 while pressed, so a press rolls it up by one and a second press rolls it back. A count that is not a finite number of 0 or more (a NaN from a failed load, a negative from a race) shows as 0.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

SocialActionLabel

<span>
PropTypeDefaultDescription
childrenRequired—The word, or a function of the pressed state for a word that changes: Follow, Following.
...props<span> attributes—Every other attribute goes to the <span>, with a ref.
  • Put a SocialActionIcon with an animated icon and a SocialActionCount or a SocialActionLabel inside SocialAction.
  • Pick the action color with color: rose for like, amber for save, green for repost, blue for follow.
  • Use variant="ghost" in an action row under a post, and soft or outline when the action stands alone.
  • Set effect on the icon part: bloom for a big moment, firework for a playful one, none for a calm one such as Follow.
  • For an on and off control with no count or burst, such as Bold or Mute, use a Toggle.
EnterTurns the action on or off.
SpaceTurns the action on or off.

It is a toggle button: assistive tools read its name and the pressed state.

The icon and the effect are hidden from assistive tools. The count is read as text.

Bloom
panel · the icon hides, a jelly disc grows and hollows into a ring, the icon pops through, then confetti
Firework
panel · 12 drops rise in a fountain and fall with gravity
Count
panel · each digit rolls up on a press to on and down on a press to off
Press
press · the pill sinks to 97% while it is held
Undo
fade · a press to off fades a playing effect out

Built with

Installs with Social Action

Components
Rolling Number
  1. AddedSocial Action, with Rolling Number.
Open the release