nuxt-x-affiliate
Reactions
Helpful / Not helpful
Reactions
The XAFReactions component renders small "Was this helpful?" reaction buttons under the article body. Default pair is 👍 Helpful / 👎 Not helpful, but the options prop accepts any reaction set. Emits vote and optionally POSTs to your endpoint.
Components
<XAFReactions />
<XAFReactions post-id="mx-keys-s-review" endpoint="/api/reactions" @vote="onVote" />
Props
| Prop | Type | Default | Description |
|---|---|---|---|
options | Reaction[] | helpful / not helpful | Reaction options. Each carries { id, label, emoji? }. |
postId | string | — | Tracking ID for analytics. |
initial | string | — | Pre-selected option ID — for restoring user state. |
endpoint | string | — | POST { postId, reaction } here. |
Events
| Event | Payload | Description |
|---|---|---|
vote | { reaction, postId? } | Fired on every vote (independent of the endpoint POST). |
The selected button shows the active state with aria-pressed="true". Counts are local-only — wire to a real endpoint to persist.
AI Context
component: XAFReactions
package: "@xenterprises/nuxt-x-affiliate"
use-when: "Helpful / Not helpful" reaction buttons with optional POST for analytics.
