Topic: col-auto not working for select and multi-select

mudassir_saifi premium asked 3 years ago

*_Expected behavior_*Expected the select to autosize based on the options in the select when col-auto is used.

*_Actual behavior_*The values inside the select are getting wrapped instead.

Resources (screenshots, code snippets etc.)

<div class="row">
<div class="col-auto">
        <select id="inputSelect" class="md-form mdb-select colorful-select dropdown-primary">
            <option value="" disabled selected>Select</option>
            <option value="1">This is a test option</option>
            <option value="1">Another test option</option>
            <option value="2">Smaller option</option>
            <option value="3">option</option>
      <label class="mdb-main-label">Test Select</label>

Krzysztof Wilk staff commented 3 years ago


I can't map your problem, could you provide a working example using our online editor? You can find it here:

Best regards

mudassir_saifi premium commented 3 years ago

Hi Krzysztof,

Apologies for the delayed response. Here is a snippet, as you can see the select is not sizing automatically based on the length of options. However if i try the same in vanilla bootstrap, it will auto size.


Marcin Luczak staff commented 3 years ago


Material Select doesn't autosize based on the options because, other than normal select, Material Select is dynamically presented into the DOM after the initialization via JavaScript. That's why its content is the one to autosize based on the width of the parent element. In this case, col-auto class is causing the select element to take its minimum width, thus options are getting wrapped. Any class that adds specific width to the element, e.g. col-6, w-100 will make your select wider.

Best regards, Marcin

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: 4.19.1
  • Device: Laptop
  • Browser: Chrome
  • OS: macOS
  • Provided sample code: No
  • Provided link: No