DEV Community

Nobu
Nobu

Posted on

How to use kebab case for class name of css in Next.js

Precondition

If I write kebab case like below, it will be error.

className={styles.company-logo}
Enter fullscreen mode Exit fullscreen mode

Solution

This will work.

className={styles['company-logo']}
Enter fullscreen mode Exit fullscreen mode

Reference
https://stackoverflow.com/questions/61794899/using-kebab-case-css-classnames-in-css-sass-modules-when-using-next-js

Top comments (1)

Collapse
 
johnsonbyjus profile image
johnson-byjus

Did u solve this.?