Reaction

Reaction is an embeddable icon survey for quick responses to content, design, or copy.

@sensefolks/reactionWCAG 2.1 AA

What Reaction Records

Choose five expressive faces, thumbs up/down, or a heart. A tap submits the reaction; tapping again undoes it.

Set the mode in your dashboard. Refreshing the page clears the current selection.

When should I use Reaction?

Place Reaction beside:

  • Blog posts and articles — Gauge reader sentiment
  • Feature announcements — Capture an immediate response
  • Help docs — Thumbs up/down for helpfulness
  • Product pages — Capture lightweight affinity with a heart
  • Release notes — Quick read on how updates land

Installation

CDN

html
<script type="module" src="https://unpkg.com/@sensefolks/[email protected]/dist/sf-reaction/sf-reaction.esm.js"></script>

NPM

bash
npm install @sensefolks/reaction

Embed Reaction

HTML

html
<sf-reaction 
  survey-key="your-survey-uuid"
  thank-you-message="Thanks for your feedback!">
</sf-reaction>

React

jsx
import '@sensefolks/reaction';

function App() {
  return (
    <sf-reaction 
      survey-key="your-survey-uuid"
      thank-you-message="Thanks for your feedback!">
    </sf-reaction>
  );
}

For Vue + Nuxt, Angular, Svelte, and Astro examples, see theEmbedding Tutorial.

API Reference

Properties

PropertyAttributeTypeDefaultDescription
surveyKeysurvey-keystring—Required. UUID of the reaction survey from your dashboard
thankYouMessagethank-you-messagestring—Overrides the thank-you message shown after submission
sessionData—Record<string, string | number | boolean>{}Complete typed Session Data matching every field in the schema defined during survey creation

Events

EventDetailDescription
sfReady{ surveyKey, reactionMode, reactionCount }Fired when the survey config has loaded
sfSubmit{ surveyKey, selectedReaction, action }Fired on create, update, or delete of a reaction
sfError{ surveyKey, errorType, errorMessage }Fired on load or submit errors

Reaction Modes

Choose one of three modes:

Dashboard labelConfig valueIconsBest for
Expressiveexpressivesentiment_extremely_dissatisfied,sentiment_dissatisfied,sentiment_neutral,sentiment_satisfied,sentiment_very_satisfiedDetailed sentiment on content or announcements
Favourite (heart)favouritefavoriteLightweight affinity or appreciation signal
Thumbs up and downthumbsUpDownthumb_up, thumb_downSimple helpful/not helpful on docs or support content

Reactions use Google Material Symbols under Apache License 2.0. Selecting an icon fills it. Default thumb colours are #43A047 for up and #F4511E for down; override them with the variables below.

Styling

CSS Custom Properties

Set theme variables on the component or a parent:

PropertyDefaultDescription
--sf-primary#005fccPrimary brand color
--sf-primary-hover#0047a3Primary hover color
--sf-text-primary#111827Primary text color
--sf-text-secondary#6b7280Secondary/muted text color
--sf-error-color#dc2626Error state color
--sf-card-bg#ffffffCard background color
--sf-card-border#d1d5dbCard border color
--sf-card-radius8pxCard border radius
--sf-button-radius6pxButton border radius
--sf-transition150ms easeTransition timing
--sf-reaction-icon-size32pxSize of reaction icons
--sf-reaction-highlight-bgrgba(0, 95, 204, 0.12)Background highlight for the selected reaction
--sf-reaction-very-dissatisfied-color#991b1bVery dissatisfied icon color
--sf-reaction-dissatisfied-color#8a3a00Dissatisfied icon color
--sf-reaction-neutral-color#665700Neutral icon color
--sf-reaction-satisfied-color#256326Satisfied icon color
--sf-reaction-very-satisfied-color#14532dVery satisfied icon color
--sf-reaction-thumb-up-color#43A047Thumbs up icon color
--sf-reaction-thumb-down-color#F4511EThumbs down icon color
--sf-reaction-thumbs-colorNot setDeprecated shared override for both thumb icons; use the separate thumb color properties for new integrations
--sf-reaction-favourite-color#991b1bHeart icon color (favourite mode)

CSS Parts

Style exposed parts with ::part():

PartDescription
containerHost element wrapper
reaction-containerMain reaction group wrapper
reactions-rowFlex row of reaction buttons
reaction-itemIndividual reaction button
reaction-item-activeActive/selected state (additive with reaction-item)
reaction-iconIcon wrapper (default and SVG types)
reaction-emojiEmoji or icon glyph inside each reaction
reaction-emoji-highlightHighlight layer behind the selected reaction
reaction-labelText label below each reaction
messageShared part on all status text
loading-messageLoading state text
completion-messageCompletion message shown after submission
error-messageError state text
error-containerError message wrapper
brandingBranding container
branding-linkBranding anchor
branding-logoBranding SVG logo
announcementsScreen reader live region

Styling Example

css
sf-reaction {
  --sf-primary: #7c3aed;
  --sf-text-secondary: #4b5563;
  --sf-reaction-icon-size: 40px;
  --sf-reaction-highlight-bg: rgba(124, 58, 237, 0.12);
  --sf-reaction-thumb-up-color: #166534;
  --sf-reaction-thumb-down-color: #7f1d1d;
  --sf-reaction-favourite-color: #7f1d1d;
}

sf-reaction::part(reaction-item) {
  padding: 0.75rem;
  border-radius: 12px;
}

sf-reaction::part(reaction-item-active) {
  background-color: rgba(124, 58, 237, 0.1);
}

sf-reaction::part(reaction-label) {
  font-weight: 500;
}

Accessibility

  • Each reaction button uses aria-pressed to convey toggle state
  • Live region announces selection changes to screen readers
  • Keyboard accessible (Tab to navigate, Enter/Space to toggle)
  • Focus indicators and high contrast mode support
  • Respects prefers-reduced-motion

Browser Support

BrowserVersion
Chrome88+
Firefox85+
Safari14+
Edge88+
IE11Not supported