Reaction Bar
Emoji reactions with counts under a message or comment, toggled by the current user, with a picker to add more.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
reactions | Reaction[] | [] | The reactions, in the order they are shown. As an attribute, a JSON array of { emoji, count, reacted }. |
quick | string[] | DEFAULT_QUICK | The reactions offered first in the popup. As an attribute, emoji separated by spaces. |
readonly | boolean | false | Shows the reactions without the add button, and pressing them does nothing. |
label | string | — | The accessible name of the bar. Defaults to "Reactions" in the page's language. |
Slots
| Name | Description |
|---|---|
picker | A c2-emoji-picker shown in the popup under the quick reactions. Its emoji-select adds that reaction and closes the popup. |
Events
| Name | Type | Description |
|---|---|---|
reaction-change | CustomEvent<ReactionChangeDetail> | The current user added or removed a reaction. Cancelable: cancel it to leave reactions unchanged. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
reaction | One reaction pill. |
emoji | The emoji in a pill. |
count | The count in a pill. |
add | The button that opens the popup. |
menu | The popup's box, holding the quick reactions and the picker slot. |
quick | The row of quick reactions in the popup. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-reaction-bar--gap | pixel | 4px | Space between the pills. |
--c2-reaction-bar__reaction--height | pixel | 28px | |
--c2-reaction-bar__reaction--padding | padding | 0 8px | |
--c2-reaction-bar__reaction--border | border | 1px solid #e4e4e7 | |
--c2-reaction-bar__reaction--border-radius | border-radius | 999px | |
--c2-reaction-bar__reaction--background-color | color | #f4f4f5 | |
--c2-reaction-bar__reaction__hover--border-color | color | #a1a1aa | |
--c2-reaction-bar__reaction__reacted--background-color | color | #edf1fe | A pill the current user reacted with. |
--c2-reaction-bar__reaction__reacted--border-color | color | rgb(2, 101, 220) | |
--c2-reaction-bar__reaction__reacted--color | color | rgb(2, 101, 220) | The count of a pill the current user reacted with. |
--c2-reaction-bar__reaction__focus--outline | outline | 2px solid rgba(2, 101, 220, 0.4) | |
--c2-reaction-bar__emoji--font-size | font-size | 16px | |
--c2-reaction-bar__emoji--font-family | font-family | Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, sans-serif | |
--c2-reaction-bar__count--color | color | #52525b | |
--c2-reaction-bar__count--font-size | font-size | 12px | |
--c2-reaction-bar__count--font-weight | font-weight | 500 | |
--c2-reaction-bar__add--color | color | #71717a | The add button's icon. |
--c2-reaction-bar__add__hover--color | color | #18181b | |
--c2-reaction-bar__menu--background-color | color | #ffffff | |
--c2-reaction-bar__menu--border | border | 1px solid #e4e4e7 | |
--c2-reaction-bar__menu--border-radius | border-radius | 8px | |
--c2-reaction-bar__menu--box-shadow | shadow | 0 4px 12px rgba(0, 0, 0, 0.12) | |
--c2-reaction-bar__menu--padding | padding | 6px | |
--c2-reaction-bar__quick--size | pixel | 32px | Width and height of each quick reaction. |
--c2-reaction-bar__quick--font-size | font-size | 20px | |
--c2-reaction-bar__quick__hover--background-color | color | #f4f4f5 | |
Text and languages
The text the component shows, in English. It shows another language when the app adds one with addTranslations, under reaction-bar, and the nearest lang asks for it; any message not translated stays in English. {0}, {1}… stand for the values a message carries. Languages guide.
| Key | English | Values |
|---|---|---|
label | Reactions | — |
add | Add reaction | — |
quick | Quick reactions | — |
reaction | {0}, {1} reactions | {0} emoji {1} count |
readonlyReaction | {0}, {1} reactions, including yours | {0} emoji {1} count {2} reacted |