Next.js Discord

Discord Forum

How Coexists css module class and next dark theme class

Unanswered
Western Meadowlark posted this in #help-forum
Open in Discord
Western MeadowlarkOP
more of a react+css question
I have a situation where I load css module and apply it to a div like this. The class applies a gradient to a div

<div className={`${styles.gradientClass}`}>


now i have darkmode so when darkmode button clicked the gradient class should disappear and need to apply dark:bg-neutral-950

<div className={`${styles.gradientClass} dark:bg-neutral-950`}>


this doesnt work since gradient is not removed in darkmode

is there a way to like apply something that behaves like

<div className={`light:${styles.gradientClass} dark:bg-neutral-950`}>

0 Replies