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

Can one set custom background transition? #113

Open
sunknudsen opened this issue May 27, 2022 · 3 comments
Open

Can one set custom background transition? #113

sunknudsen opened this issue May 27, 2022 · 3 comments

Comments

@sunknudsen
Copy link

Trying to time switch toggle with dark mode transition… thanks so much for component!

@markusenglund
Copy link
Owner

Hi, if I understand you correctly you want the color transition of the switch to have the same duration as the dark mode transition?
I don't think it's a good idea to mess with since the transition property is already set to match the speed of the toggling. From the source code:

transition: $isDragging ? null : "background 0.25s"

@sunknudsen
Copy link
Author

sunknudsen commented Jun 9, 2022

Hey @markusenglund,

If you go to https://sunknudsen.com/privacy-guides and click account icon (bottom right), you can switch between light and dark modes (used react-switch, thanks!).

I wanted switch transition from light to dark mode (hardcoded to 0.25s in react-switch) to match transitions of website (which, at the time, were set to 0.3s… ended up using same delay as react-switch given delay cannot be changed using props).

Would be nice if transition delay, timing function, etc… could be user-configurable using props.

Thanks again for component!

@markusenglund
Copy link
Owner

Got it. That could absolutely be implemented as a prop, but maybe it's a bit too rare of a use-case to be added to the API, I'm not sure.

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

No branches or pull requests

2 participants