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

[Feature Request] Allow programmatically controlling the ThemePanel component #382

Open
snelsi opened this issue Mar 17, 2024 · 8 comments
Labels
request New feature or request

Comments

@snelsi
Copy link

snelsi commented Mar 17, 2024

ThemePanel component is great, but I think it can be improved by allowing the user to control more of its behavior:

  1. Allow passing open and onOpenChange to ThemePanel to control it's state
  2. Allow customizing hotkeys for "show/hide" and "switch dark mode" actions. Also, allow passing null to disable a hotkey.

Here are a couple of great custom hotkey hooks for inspiration:
https://github.com/JohannesKlauss/react-hotkeys-hook
https://github.com/arthurtyukayev/use-keyboard-shortcut
https://github.com/greena13/react-hotkeys

@vladmoroz
Copy link
Contributor

Why are you interested in that? What are you trying to achieve in your app?

@snelsi
Copy link
Author

snelsi commented Mar 17, 2024

I want to add a custom button in the header/footer that toggles a ThemePanel on click.
And I want to remap default "T" and "D" hotkeys to something else.

Also, when ThemePanel is closed it really misses some sort of floating button that reopens it.

@vladmoroz
Copy link
Contributor

I am more interested about this in terms of what this achieves for your users? Why do you need Theme Panel in production? It was never meant as a component that the end user would see; it's just a tool for us to demo the theme options better and for the developer to explore their app style.

@snelsi
Copy link
Author

snelsi commented Mar 17, 2024

I'm building a catalogue of premade components/sections.
Very similar to Radix Playground.
I'm using it to demo the theme options better as well.

@snelsi
Copy link
Author

snelsi commented Mar 17, 2024

In general, I don't see why ThemePanel can't be used in production to allow user to customize the appearance of the app. Especially when working with dashboards / platforms and not stuff like landing pages.

@vladmoroz
Copy link
Contributor

Feel free to PR open and onOpenChange props and a prop to disable hotkeys.

We won't want to add a way to reassign hotkeys because using Theme Panel in a real app is not a case that we see as legitimate/realistic; nor it makes sense to add a dependency for that.

@vladmoroz vladmoroz added the request New feature or request label Mar 20, 2024
@snelsi
Copy link
Author

snelsi commented Mar 20, 2024

Okay, I'll take a look today

@snelsi
Copy link
Author

snelsi commented Mar 20, 2024

@vladmoroz
Here's a PR with discussed changes:
#393

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

No branches or pull requests

2 participants