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] Third state for switch icon: in progress and a function to call. #1886

Open
GrzegorzDrozd opened this issue May 3, 2024 · 0 comments

Comments

@GrzegorzDrozd
Copy link

Is your feature request related to a problem? Please describe.
I would like to have a xhr request on switch toggle - for example to star or unstar element. It would be nice to have a third state icon (for example a progress spinner) that I could display (even manually). It would be also nice to provide a function name to call or event that I can bind to.

Describe the solution you'd like

<button class="switch-icon (<empty>|active|progress)" data-bs-toggle="switch-icon" data-ontoggle="function_name_to_call_on_toggle">
  <span class="switch-icon-a">
  </span>
  <span class="switch-icon-b">
  </span>
  <span class="switch-icon-progress">
  </span>
</button>

When function name is provided then -progress icon is displayed untill that function returns true. (maybe returning false would display 4th icon ? that would be even more perfect ;)

Describe alternatives you've considered
I am not that fluent with javascript so I am trying to do a very messy workarounds to make it happen :/

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

1 participant