-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
v4.2: switch custom form control #23004
Conversation
fixes a part of #22090 |
Dope! Thank you for jumping in on this. I'll take a look at it for our v4.1 ship :). |
@mdo @XhmikosR @andresgalante I messed up here :( and cant figure out how to revert it, any suggestions? -----edit----- |
@gijsbotje: you can just do |
maybe i did something wrong, but it didn't work... |
3f3fd85
to
0814b27
Compare
@gijsbotje: you had messed up your branch. Do not merge from upstream. Just rebase it, if needed. Now, I cleaned it up and force pushed it. So, make sure you do |
@XhmikosR thanks dude, will do |
@gijsbotje / @mdo the solution to modifying the custom-checkbox with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be added to bootstrap, so that we don't need any external library for this purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its a good option to have
"mdo removed this from Inbox in v4.2" :( |
Yeah, that was the issue I noticed too when I said I didn't think this was ready along with transitioning costly properties. I'll try to have a look tomorrow, but @MartijnCuppens will probably beat me to it. |
@XhmikosR @MartijnCuppens would this be ok? i used the color of the border for the indicator |
Can you include screenshot of other special control (eg. checkbox) being on/off/disabled, for comparison? Also, is there "disabled + on" state? |
@rafalp i've paired the switch with its checkbox equivalent thanks for reminding me about the |
- changed the indicator to not use the an svg - changed animation to use transform - tweaked height and with calculations of the indicator - added disabled+checked support - tweaked scss markup so it's the same as customo radio and checkbox
… custom-switch-form-control
@MartijnCuppens fixed your comments as best as I could think of. |
Those are looking very good, thanks 👍 |
@gijsbotje, the color of the circle looks ok. Maybe it's possible to tweak this a bit to so that it's possible to set the following variables:
If we have control over this in |
I would be careful with making switch too big - you'll potentially end with component being too big to use "inline", requiring special positioning or, worse, custom form layout altogether. |
Good point, @rafalp. Forget about size increment than. |
Yeah, I am thinking now how this component should be sized. Right now its sized same way checkbox is, meaning its interchangeable with it. Perhaps it should also support Just dropping ideas - it may be too late for this, or material for new PR bumping extra sizing to custom controls? |
💡 Support for contextual classes could be interesting, too. |
@m5o I would do that as a seperate PR as it also affects the other controls
@rafalp Indeed as you said yourself
@MartijnCuppens I was fiddling around with the variable If we implement this change, controlling What i'm really struggling with and get wrap my head around is making the height and circle size customizable. I'm currently using the calc css function to get the height and with like this: i'm also struggling with the positioning of the circle when you increase or decrease the size of the circle. currently this calc function is taking care of the vertical positioning: I'm far from a math guy so if so if someone could assist me in these issues that would be much appreciated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, more control over sizing is something we can look into later
This adds a neat styling feature for the custom form controls.
Markup stays the same as the checkbox but displays it as a toggle switch.
https://codepen.io/gijsbotje/pen/rwKMmy
https://deploy-preview-23004--twbs-bootstrap4.netlify.com/docs/4.1/components/forms/#switches