# The on-page reaction picker

> Choose a page's reactions while looking at it: a small picker for your CMS's draft or preview template, driven by an authoring key.

[Different reactions per post](https://docs.tapback.party/blog-reactions/#different-reactions-per-post) starts with a `reactions` attribute in the post's source. This page is the other route: a picker that sits in your editing UI and shows every approved reaction as a chip. Tap the ones you want, in the order you want them, and save — the page is re-pointed on the spot, and the bar refreshes so you see what a reader will. It's a Plus feature.

## Set it up

The picker is driven by an **authoring key**, a separate credential minted in the console's API keys panel (Plus plan). The key can do two things: read your approved reaction set, and point a page at a subset of it. That narrow scope is why it's safe to put in a template — if it ever leaks, the worst anyone can do is rearrange pages among reactions you already approved, and you can revoke it in one click.

Paste the snippet (the console hands it to you with the key) into your CMS's **draft or preview template** — the one only authors see:

```html
<script type="module" async src="https://api.tapback.party/editor.js"
        data-key="ak_live_…" data-api="https://api.tapback.party"></script>

<tapback-editor></tapback-editor>
```

The `<tapback-editor>` element is the picker, and it renders exactly where you put it — so it can sit in your editing UI's sidebar rather than on top of the post. It's a plain block element: your CSS positions it, and it picks up the `--tapback-*` [custom properties](https://docs.tapback.party/theming/) your site already sets. If you'd rather not find it a home in your layout, `<tapback-editor float>` pins a button to the corner of the viewport instead.

A sidebar showing the picker usually wants the bar beside it, and there's a catch: it's a live reader bar, so an author trying it out lands in the post's real tally. Add `readonly` to that copy — `<tapback-bar entity="blog/hello-world" layout="inline" readonly>` — and it shows the current set with its live counts while ignoring taps.

In Hugo or Zola that's a template gated on the dev server or a draft flag; in WordPress, an `is_preview()` or admin-bar hook; in Ghost, the preview template. Keep it off your public pages — your readers would see an edit button that rejects them.

Check that the gate is off in the build you deploy. Jekyll is the common trap: `jekyll build` defaults to the `development` environment, so a `jekyll.environment == 'development'` check ships the picker, and its authoring key, on every post unless the deploy build runs with `JEKYLL_ENV=production` (GitHub Pages sets it for you).

Editing UIs built in JavaScript can skip the markup: `window.tapbackEditor.mount("#sidebar", { entity: "blog/hello-world" })` creates the element, drops it in, and hands it back. Naming the `entity` means the picker needs no bar beside it, which is what you want when the post itself renders in an iframe.

Unlike the `reactions` attribute, the picker can change a page that's already live: saving re-points it and keeps the earlier counts as read-only history — the same move as the ☰ picker in the console's **Pages** tab. The picker only works on the Tapbar's allowed sites, so add your preview or dev host there too. Under a Content-Security-Policy it needs the same sources as the bar and no `style-src` — see [Troubleshooting](https://docs.tapback.party/troubleshooting/#content-security-policy).

The [embed reference](https://docs.tapback.party/embed-reference/#the-editor-script-authoring) lists every attribute the editor script and the `<tapback-editor>` element accept.
