A Bootstrap 5 satisfaction widget that asks one quick question and lets visitors answer with five emoji faces, from Terrible to Excellent. Drop it after checkout, at the end of a help article or in an onboarding flow where a star rating feels too formal.
How it works
The card is a section.efr-card inside a pastel gradient .efr-wrap. The faces are a real radio group: five input.efr-input elements (hidden with Bootstrap's visually-hidden) inside a fieldset, each followed by a label.efr-face that holds an inline SVG face and a text label. The faces are drawn with SVG circles and paths instead of emoji characters, so they look the same everywhere. The .efr-scale grid keeps all five in one row, even on narrow phones.
Unselected faces are muted with filter: saturate(0.25). Hovering a face restores its color and lifts it slightly; the checked face gets a tinted background, a colored border and a springy scale(1.18). All of this is pure CSS using the :checked + .efr-face sibling selector.
The script runs on DOMContentLoaded for every .efr-card. On each change it copies the data-efr-prompt of the chosen input into the .efr-prompt label above the comment box, so a low score asks "What went wrong?" and a high score asks what the visitor enjoyed. On submit it calls preventDefault(), shows the spinner inside .efr-submit and after 800 ms writes a thank-you message into .efr-status. If no face is selected, it shows an error instead.
Customization
--efr-accentand--efr-accent-hoveron.efr-wrapinstyle.css: change the color of the badge text, the focus ring and the submit button.--efr-facein.efr-face--1to.efr-face--5: set the fill color of each face.data-efr-prompton eachinput.efr-input: change the follow-up question shown above the comment box for that score.- The
.efr-face__textspans: rename the five labels, such as "Very unhappy" to "Very happy". checkedon the fourth input inindex.html: move it to preselect another face, or remove it to start with no selection.max-width: 560pxin.efr-card: make the card wider or narrower.- The
setTimeoutin the submit handler ofscript.js: replace it with your ownfetch()call that sends thepayloadobject.
Use cases
- Support pages: visitors rate help with five faces from Terrible to Excellent
- Post-purchase surveys: a mood-aware comment prompt asks the right follow-up question
- SaaS apps: a quick feedback card collects sentiment with one click
- Documentation sites: a simulated submit shows a thank-you state after rating
Accessibility
Because the faces are native radio buttons, the arrow keys move between them and Tab leaves the group, as users expect. The fieldset has a visually hidden legend that explains the 1 to 5 scale, and every face has a visible text label, so screen readers announce "Good, radio button, 4 of 5". The SVG icons are aria-hidden. A focused face gets a 3 px outline through .efr-input:focus-visible + .efr-face. .efr-status is a role="status" live region, so the confirmation and the error are announced. Under prefers-reduced-motion: reduce the transitions and scale effects are turned off.
Usage notes
Requires only Bootstrap 5. The radio id, for and name values must be unique on the page, so rename them when you add a second card.