# ReactionBar

> The row of emoji reactions under a message: each a chip with its emoji and count, pressed when the reader is among those who reacted, a slot for adding one, and a template for chips added in place.

```ts
import { ReactionBar } from "@sdxc/ui/chat";
```

Renders the row as a `role="group"` that wraps onto a second line when a message collects
many reactions, and hides itself while it holds no chip.

## Examples

```tsx
<ReactionBar aria-label="Reactions">
	<form method="post" action="/messages/42/react"><input type="hidden" name="emoji" value="🎉" /><ReactionBar.Reaction emoji="🎉" label="Party popper" count={3} pressed /></form>
</ReactionBar>
```

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `"aria-label"` | `string` | Names the row for assistive technology, such as "Reactions". |
| `children` | `RemixNode` | One form per ReactionBar.Reaction, then an optional ReactionBar.Add and ReactionBar.Template. The row hides while it holds no reaction. |

Also accepts everything in `Omit<TagProps<"div">, "aria-label">`.


### ReactionBar.Reaction

Renders one reaction chip: a submit button sending the toggle that flips the reader's reaction, `aria-pressed` while they are among its reactors, and its count in tabular figures so the row never shifts.

| Prop | Type | Description |
| --- | --- | --- |
| `emoji` | `string` | The emoji, or the shortcode of a custom one drawn from `image`. |
| `image?` | `string` | A custom emoji's image, drawn in place of the emoji's text. |
| `label` | `string` | What the emoji is called, such as "Party popper"; a screen reader hears it before the count. |
| `count` | `number` |  |
| `pressed?` | `boolean` | Whether the reader reacted with this emoji; the chip draws pressed. |
| `toggle?` | `Toggle` |  |

Also accepts everything in `Omit<
		TagProps<"button">,
		"children" | "aria-label" | "name" | "value"
	>`.


### ReactionBar.Add

Renders the trailing slot for adding a reaction, where an emoji picker's trigger sits.

| Prop | Type | Description |
| --- | --- | --- |
| `children` | `RemixNode` | The add-reaction control, such as a button opening an emoji picker. |

Also accepts everything in `TagProps<"span">`.


### ReactionBar.Template

Renders the inert `<template>` a new chip is cloned from, so a reaction picked from an emoji picker appears in the row at once, posting through the same form a server-drawn chip uses.

| Prop | Type | Description |
| --- | --- | --- |
| `children` | `RemixNode` | The form a new reaction posts with, holding an `<input data-reaction-emoji>` for its emoji and one ReactionBar.Reaction; `reactionSync()` clones and fills it. |

