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

Add styling for <input type="range"> #17916

Closed
bhutaninitin opened this issue Oct 13, 2015 · 10 comments
Closed

Add styling for <input type="range"> #17916

bhutaninitin opened this issue Oct 13, 2015 · 10 comments

Comments

@bhutaninitin
Copy link

No description provided.

@cvrebert cvrebert changed the title New feature request: Add a style class for input type="range" Add custom form control for <input type="range"> Oct 13, 2015
@cvrebert
Copy link
Collaborator

This would fall under the "Custom form elements" (http://v4-alpha.getbootstrap.com/components/forms/#custom-forms ) and would be particularly challenging since it'd require JavaScript.

@bhutaninitin
Copy link
Author

Javascript would be nice but only styling would be much helpful. If a project has input type=range component, it will stand out due to lack of css style.

<input type="range" min="0" max="100" value="0" step="20" name="result" list="grade">
<datalist id="grade">
<option value="0">
<option value="40">
<option value="60">
<option value="80">
</datalist>

@cvrebert cvrebert changed the title Add custom form control for <input type="range"> Add styling for <input type="range"> Oct 14, 2015
@gastlich
Copy link

Since bootstrap v4 has dropped support for IE8 and range input is supported in IE10+ there is quite reasonable way to do it without any javascript code:

https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/

It could look like this:
slider

The question is if it's worth doing? It involves quite a lot of code specified for almost every browser engine....

For me custom styling would be helpfull, but will it be usefull for the rest of users?

@bhutaninitin
Copy link
Author

This example doesn't seem (to me) to include the styling for the step attribute.

@gastlich
Copy link

Are you talking about step attribute + datalist element, to generate ticks for sliders?

Currently native styling for datalists is unstable and it's support is weak. But what can be done to style these ticks, is to use datalist as a standard markup and generate manually these ticks using plain css. I've done this using flex and space-between justification.

search2

@bhutaninitin
Copy link
Author

Sounds interesting. Can you post an example?

@gastlich
Copy link

This is very quick example how it was done:

https://jsbin.com/mozirozasi/edit?html,css,output

I know that it's not pixel perfect and so on, and I didn't hide datalist values in a proper way, but I haven't got enough time.

The most interesting part for you is follwing:

datalist {
  display: flex;
  justify-content: space-between;
}

@bhutaninitin
Copy link
Author

Thanks for the example. I hope something related to this comes with the next bootstrap.

@bhutaninitin
Copy link
Author

Hi,
Just dropping a note to check if anything related to input type="range" is coming in bootstrap 4.

Thanks,
Nitin

@mdo mdo modified the milestone: v4.1 ideas Nov 26, 2016
@mdo mdo added the has-pr label Jan 20, 2018
@mdo
Copy link
Member

mdo commented Feb 25, 2018

Custom range was added in #25600.

@mdo mdo closed this as completed Feb 25, 2018
@mdo mdo removed this from the v4.1 ideas milestone Feb 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants