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

QR code component with TailwindCSS

accessibility, tailwind-css
AriyanSep0_0•330
@ARiYaNSEp0-0
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What specific areas of your project would you like help with?

currently I am learning tailwind css and these are my questions :

  • does my code violate any tailwind standard or best practices
  • when we don't have pre classes in tailwind as here for rounded corners (20px, 10px) should I change default lg or sm classes or add new keyword for it ? like rounded-img

thanks for your future feedback

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Wendy•2,150
    @wendyhamel
    Posted 10 months ago

    Hi there, nice work on this challange.

    I hope you like working with tailwind. I use it all the time and it saves me a lot of time and helps me keep my code consistent, better to maintain and customisable at the same time.

    I do not see anything in your code that violates standards or best practice. Then again, there is a lot of flexibility in how you can use tailwind. Some would like to have their class names in a peticular order, first the classes for the container, then the classes for text so it is better to maintain: you always know where to look.

    In your tailwind.config I noticed you used the tailwind color names for the colors in your project. You extend the color sets with these new project colors, or in this case, you overwrite some of the tailwind colors. The other color variants like blue-500, blue-800 or gray-500 are still the ones from the tailwind set. This is not really a problem, as long as you are aware of it. If you use these color names directly in the theme, without extending, you overwrite the whole set and the ones you do not include, do not exist. In your that would be blue-800 or gray-500. So you need to be aware tht you do not heve the in between colors.

    As to the extra classes you need, I add them on the fly rounded-[20px] and only extend the set if I use them more than once. If it makes sense to add it to the existing set, I will do that. To use your example, I would add rounded-2.5xl: '1.25rem' to the tailwind set. This will be the same as 20px with default font size settings and will scale with the rest of the site if the default is changed. Naming the 10px one, I would probably go for rounded-0.5xl: '0.625rem' to place it between lg and xl.

    One of the benefits of using tailwind is not having to name everything. Saves a lot of time. So when I do need it, I tend to stay close to the naming they use.

    Happy coding!

    Marked as helpful

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