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

Enhancement: Ability to specify custom width #46

Closed
kayzee opened this issue Jan 31, 2013 · 2 comments
Closed

Enhancement: Ability to specify custom width #46

kayzee opened this issue Jan 31, 2013 · 2 comments

Comments

@kayzee
Copy link

kayzee commented Jan 31, 2013

The span* functionality works well, but I need to specify a custom width.

I found that setting the width style in each of the following elements will give the desired result, but I can't quite figure out how to modify bootstrap-select.js.

.btn-group.bootstrap-select
button.btn.dropdown-toggle.clearfix

Support for a width data attribute like this would be amazing:

<select class="selectpicker" data-width="80px">
@kayzee
Copy link
Author

kayzee commented Jan 31, 2013

I made a work-around for the issue that works very well, however it might still be nice to support a width data attribute.

I wrapped the select elements in a div with class "my-select" and in my CSS file, I just use the following to override the default widths:

.my-select {
  .btn-group.bootstrap-select {
    width: 90px;

    button {
      width: 90px;
    }
  }
}

@silviomoreto
Copy link
Collaborator

Hi @kayzee. I guess doing this by css is the best way, since, like bootstrap forms, we can just specify a few classes to change width and maintain the responsive layout

caseyjhol added a commit that referenced this issue Aug 21, 2018
Note: this will probably have a negative effect on performance for selects with a lot of options (1000+). Consider defaulting to text only in future updates, with an option to allow HTML
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