Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 4 months ago

interactive-rating

tailwind-css
P
Alexwz89•480
@Alexwz89
A solution to the Interactive rating component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

To review the tailwind css and of course forms..

What challenges did you encounter, and how did you overcome them?

The hardest part of this exercise was how to generate the scoring from 1 to 5 using semantic html and pass it to the next DOM element after submission.

At first I generated a button for each score, and suddenly realised that it seemed to make more sense to use radio while i was writing javascript, since the required action of a button in a form does not include passing data!

So I spent some more time with GPT, and fortunately both GPT and Grok suggested using a label + radio type input implementation. Also, you can rely on peer and checked to define the style of the sibling DOM element, wonderful !

keep learning... lol

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • vong•190
    @vong0-0
    Posted 3 months ago

    What are you most proud of, and what would you do differently next time? I’m proud of the way I implemented the interaction flow and UI elements using React and TailwindCSS. The use of Tailwind allowed me to quickly style the component with minimal code, which kept the project lightweight and responsive. I'm also pleased with how I structured the components—separating the rating and thank-you dialogs into distinct components made the code more modular and readable.

    Next time, I would pay more attention to the accessibility of the elements, especially when interacting with form elements like buttons and radio inputs. I’d also look into optimizing for different screen sizes to ensure the layout works well on all devices.

    What challenges did you encounter, and how did you overcome them? The hardest part of the exercise was handling the rating submission and dynamically passing the rating value to the "Thank You" dialog. Initially, I thought of using buttons for each score, but after some consideration and research, I realized that using a radio button system would be semantically more appropriate for a rating scale.

    I ran into a challenge in using buttons because they weren’t well suited for form submission (and I didn’t want to manipulate form behavior unnecessarily). The solution came when I found that using <label> and <input type="radio"> allowed me to take advantage of the form’s behavior while also making it easier to capture and pass the rating value to the next DOM element.

    This is where GPT and Grok really helped me by suggesting this approach. I learned a lot about leveraging the peer and checked classes in Tailwind to style radio buttons and their labels dynamically, which was fantastic!

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub