2022-03-23
1982
#nextjs
Marie Starck
99501
Mar 23, 2022 â‹… 7 min read

The best styling options for Next.js

Marie Starck Marie Starck is a fullstack software developer. Her specialty is JavaScript frameworks. In a perfect world, she would work for chocolate. Find her on Twitter @MStarckJS.

Recent posts:

Rxjs Adoption Guide: Overview, Examples, And Alternatives

RxJS adoption guide: Overview, examples, and alternatives

Get to know RxJS features, benefits, and more to help you understand what it is, how it works, and why you should use it.

Emmanuel Odioko
Jul 26, 2024 â‹… 13 min read
Decoupling Monoliths Into Microservices With Feature Flags

Decoupling monoliths into microservices with feature flags

Explore how to effectively break down a monolithic application into microservices using feature flags and Flagsmith.

Kayode Adeniyi
Jul 25, 2024 â‹… 10 min read
Lots of multi-colored blue and purplish rectangles.

Animating dialog and popover elements with CSS @starting-style

Native dialog and popover elements have their own well-defined roles in modern-day frontend web development. Dialog elements are known to […]

Rahul Chhodde
Jul 24, 2024 â‹… 10 min read
Using Llama Index To Add Personal Data To Large Language Models

Using LlamaIndex to add personal data to LLMs

LlamaIndex provides tools for ingesting, processing, and implementing complex query workflows that combine data access with LLM prompting.

Ukeje Goodness
Jul 23, 2024 â‹… 5 min read
View all posts

6 Replies to "The best styling options for Next.js"

  1. I think you make a mistake in the cons to of css modules.

    Potential styling conflicts when used in large projects.

    Not really css are managed by JavaScript for give scope (always have a hash to prevent collision)

    No dynamic styling (e.g., based on a status like loading, error, success, etc.)
    This would be implemented with data-attributes.

    And another pro is that CSS Modules is more fast than another styles solutions.

    1. I… totally did. 🤦‍♀️ Thank you for bringing that to my attention. I will get that fixed.

      As for data-attributes, I couldn’t find a good and easy example. The best I could find was Sasha’s guide to write CSS components using data attributes (https://sacha.me/articles/css-data-components). Compared to Emotion where you can just pass in props and any conditional styling you want, using data-attributes sounds complicated.

      1. Nothing complicated about using data attributes. CSS (especially SCSS) modules are boss. Never understood the whole appeal of “single file components”. One tab for html/jsx another for css and you’re clean and in business. No need to get out of sync with the rest of the web and constantly change to a new hipper syntax each year. Have you thought of the headaches of opening up a tailwind or css-in-js site 5 years from now when whatever library du jour you used is long defunct and a security liability?

        “`css
        div[data-invalid] {
        color: red;
        }

        div:not([data-invalid]) {
        display: none;
        }
        “`

        “`javascript
        Name is a required field
        “`

    2. Hi Anthony,

      Thanks for reading this blog post and catching this error! We’ve updated the post with the corrected information.

Leave a Reply