Next.js Discord

Discord Forum

I need helps with my shadcn/ui component in NextJS. Specifically with the DropdownMenu.

Answered
sh1ro posted this in #help-forum
Open in Discord
Avatar
I don't want to use dark/light mode on my web app, but, there is a problem with my <DropdownMenu> component, that is when I hover, or click on it, the background color of it, instead of the dark black I set, it just turn white. How can I fix it?
Image
Image
Answered by Dutch Smoushond
what you want is hover:bg-black hover:text-white
View full answer

22 Replies

Avatar
have you forced the default theme to be dark? if so how did you do it?
Avatar
@Alfonsus Ardani have you forced the default theme to be dark? if so how did you do it?
Avatar
How would you force set the default theme to dark?
Avatar
if you look at the ThemeProvider from next-themes, there is a prop that you can set it to dark
Avatar
@Alfonsus Ardani if you look at the ThemeProvider from next-themes, there is a prop that you can set it to dark
Avatar
I tried that… everything just turns white not as I expected. I just only want to see dark on my current ui…
Avatar
wait what
Avatar
@Alfonsus Ardani wait what
Avatar
Idk how and why either!?
So I just don’t want this frontpage has any kind of lightmode here.
Avatar
@sh1ro So I just don’t want this frontpage has any kind of lightmode here.
Avatar
Dutch Smoushond
can you share your dropdown menu code
Avatar
@sh1ro It's just the base `<DropdownMenu>` from https://ui.shadcn.com/docs/components/dropdown-menu
Avatar
Dutch Smoushond
add classnames for trigger ig that will do it
Avatar
@Dutch Smoushond add classnames for trigger ig that will do it
Avatar
How would you write the className?
Avatar
@sh1ro How would you write the `className`?
Avatar
Dutch Smoushond
something like this
Image
do you want me to write the exact css classes?
Avatar
@Dutch Smoushond something like this
Avatar
My problem is in the DropdownMenuSubTrigger, I did change the hover:text-white but nothing change.
Maybe like this?
Image
Avatar
@Dutch Smoushond do you want me to write the exact css classes?
Avatar
Wait a bit, lemme try other color.
make it black xd
Avatar
@sh1ro My problem is in the `DropdownMenuSubTrigger`, I did change the `hover:text-white` but nothing change.
Avatar
Dutch Smoushond
what you want is hover:bg-black hover:text-white
Answer
Now it's working.
Sorry for asking goofy ahh question.