Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force light theme on specific component #2814

Closed
benbaessler opened this issue Feb 21, 2024 · 5 comments
Closed

Force light theme on specific component #2814

benbaessler opened this issue Feb 21, 2024 · 5 comments
Labels

Comments

@benbaessler
Copy link

I'd like to always apply the light theme to a specific Dialog component in my project, even if the selected theme is dark mode. Is this somehow possible?

@dan5py
Copy link
Contributor

dan5py commented Feb 29, 2024

Hi @benbaessler you can add a custom light class like this:

Update the globals.css file:

@layer base {
  :root, .light {
  /* rest of css file */

And then you can use it in your components:

<div className="light">
  Forced light mode
</div>

@shadcn shadcn added the Stale label Jun 3, 2024
@shadcn
Copy link
Collaborator

shadcn commented Jun 11, 2024

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

@shadcn shadcn closed this as completed Jun 11, 2024
@bhatvikrant
Copy link

Hi @benbaessler you can add a custom light class like this:

Update the globals.css file:

@layer base {
  :root, .light {
  /* rest of css file */

And then you can use it in your components:

<div className="light">
  Forced light mode
</div>

This did not work for me

@FrancescoSaverioZuppichini

same here!

@softmarshmallow
Copy link

Nice clean solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants