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>| Prop | Type | Default | Description | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| color | "amber""blue""green""rose" | "rose" | ||||||||||||||||||||||||||||||
| size | "default""lg""sm""xl" | "default" | ||||||||||||||||||||||||||||||
| variant | "ghost""outline""soft" | "soft" | ||||||||||||||||||||||||||||||
| class | string | — | ||||||||||||||||||||||||||||||
From Base UIToggleBase UI docs | ||||||||||||||||||||||||||||||||
| pressed | boolean | — | Whether the toggle button is currently pressed. This is the controlled counterpart of defaultPressed. | |||||||||||||||||||||||||||||
| default | boolean | false | Whether the toggle button is currently pressed. This is the uncontrolled counterpart of pressed. | |||||||||||||||||||||||||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | |||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. | |||||||||||||||||||||||||||||
SocialActionIcon
<span>| Prop | Type | Default | Description |
|---|---|---|---|
| render | — | 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>| Prop | Type | Default | Description |
|---|---|---|---|
| locale | string | — | 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. |
| format | NumberFormatOptions | — | 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. |
| count | number | — | 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>| Prop | Type | Default | Description |
|---|---|---|---|
| children | — | 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. |
| Enter | Turns the action on or off. |
|---|---|
| Space | Turns the action on or off. |
Built with
Installs with Social Action
- Components
- Rolling Number



