# Reactions

> Emoji reactions and up or down votes on any subject and on messages, with per-tenant custom emoji, counts and a vote score per subject under the subject's own read rules and a realtime topic per tenant.

- Category: Collaboration
- Module: `reactions`
- Modes: `managed`, `custom`
- Docs: https://bettersupabase.com/docs/blocks/reactions
- Page: https://bettersupabase.com/blocks/reactions

## Install

```bash
npx better-supabase add reactions
```

The command also installs `updated-at`, `memberships`, `permissions`.

## Configure

Add the block to `better-supabase.config.ts`:

```ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  blocks: {
    // Required by reactions; add installs them too.
    "updated-at": {},
    memberships: {},
    permissions: {},
    // Modes: "managed", "custom". The default is "managed".
    reactions: { mode: "managed" },
  },
});
```

## Client

The React hooks are the registry item `@better-supabase/use-reactions` (`npx shadcn add @better-supabase/use-reactions`). They return data and actions and render no UI. Source: https://github.com/ScaleDockHQ/better-supabase/blob/main/packages/registry/items/hooks/use-reactions.ts

## Events

- `reaction.added`
- `reaction.deleted`

## Related blocks

Requires: [memberships](https://bettersupabase.com/blocks/memberships.md), [permissions](https://bettersupabase.com/blocks/permissions.md)

Works with: [outbox](https://bettersupabase.com/blocks/outbox.md), [messaging](https://bettersupabase.com/blocks/messaging.md)

## Recipes

- [Reactions bar](https://bettersupabase.com/recipes/reactions-bar.md): Emoji reactions under a record with counts, which toggle the caller's own reaction.
