# Emoji Feedback Rating

> Five emoji faces for quick feedback, greyed out until one is picked, which then pops up in full color.

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: emoji, feedback, rating, satisfaction, radio, survey
- Live preview: https://copy-css.com/snippets/emoji-feedback-rating
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<fieldset class="emoji-rate">
  <legend>How was your experience?</legend>
  <label><input type="radio" name="mood" value="1" aria-label="Terrible"><span aria-hidden="true">😠</span></label>
  <label><input type="radio" name="mood" value="2" aria-label="Bad"><span aria-hidden="true">🙁</span></label>
  <label><input type="radio" name="mood" value="3" aria-label="Okay"><span aria-hidden="true">😐</span></label>
  <label><input type="radio" name="mood" value="4" aria-label="Good" checked><span aria-hidden="true">🙂</span></label>
  <label><input type="radio" name="mood" value="5" aria-label="Great"><span aria-hidden="true">😍</span></label>
</fieldset>
```

## CSS

```css
.emoji-rate {
  margin: 0;
  padding: 16px 14px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  font-family: system-ui, sans-serif;
  text-align: center;
}

.emoji-rate legend {
  float: left;
  width: 100%;
  margin-bottom: 10px;
  padding: 0;
  color: #431407;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.emoji-rate label {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
}

.emoji-rate input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.emoji-rate span {
  font-size: 26px;
  line-height: 1;
  filter: grayscale(1);
  opacity: 0.5;
  transition: transform 0.2s cubic-bezier(0.4, 1.6, 0.6, 1), filter 0.2s ease, opacity 0.2s ease;
}

.emoji-rate label:hover span {
  filter: grayscale(0.3);
  opacity: 0.9;
}

.emoji-rate input:checked + span {
  filter: none;
  opacity: 1;
  transform: scale(1.3);
}

.emoji-rate label:has(:checked) {
  background: #ffedd5;
}

.emoji-rate label:has(:focus-visible) {
  outline: 2px solid #ea580c;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .emoji-rate span {
    transition: none;
  }
}
```

## Notes

- This CSS Emoji Feedback Rating is 70 lines of pure CSS (1.2 KB) with no JavaScript and no dependencies. It uses transitions, transforms, filters and CSS Grid.
- the :has() selector: Chrome 105+, Safari 15.4+, Firefox 121+.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
