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

switch: What customizability for animations should be supported? #816

Open
josepharhar opened this issue Aug 24, 2023 · 3 comments
Open
Labels
switch Switch control

Comments

@josepharhar
Copy link
Collaborator

I am interested in nailing down what the use cases for <switch> are.
It seems like rendering content on top of the two sides of the track and the thumb are important.

In @gfellerph's new switch explainer I saw this:

Findings (from 44 analyzed Design Systems):

  • 70% of Design Systems don’t display any content inside their switches
  • 30% display content on the track
  • 18% display content on the thumb
  • 88% use the background color transition animation
  • 16% use a track slide animation

For the "background color transition animation" and "track slide animation", does the design system allow the developer to customize the animation itself? Or does it just mean that the design system has an animation that is not customizable?

I am sure that <switch> will have an animation by default for these things, but do we need to provide developer controls to change how they work?

@josepharhar josepharhar added the switch Switch control label Aug 24, 2023
@chrisdholt
Copy link
Collaborator

I am sure that will have an animation by default for these things, but do we need to provide developer controls to change how they work?

I might be missing the intent of your question, so forgive me if that is the case :).

Even if design systems currently don't allow for the customization of the background animation, if we don't provide a method for developers to customize it wouldn't that prevent design systems authors from implementing their own custom animations?

@josepharhar
Copy link
Collaborator Author

Even if design systems currently don't allow for the customization of the background animation, if we don't provide a method for developers to customize it wouldn't that prevent design systems authors from implementing their own custom animations?

Yes it would! Can you think of any ways that a design system might want to customize the animations?

@gfellerph
Copy link
Contributor

@josepharhar, Design Systems usually don't provide a way to customise the animation. The one example that offers a lot of variation is ant design system, where switches with content use the track slide animation and switches without content use the background transition. I think the default animation should be a background transition, due to popularity. The track slide animation should be something that authors can easily add (overriding the background transition).

Some track slide animations also have very slight variation with a parallax effect where content and track don't move at the same speed. In my understanding, it would complicate implementation a lot if there were two different animation techniques baked into the <switch>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
switch Switch control
3 participants