Autocomplete dropdown width


Topic: Autocomplete dropdown width

CarrierLog pro premium priority asked 3 weeks ago

Is there any way to control the width of the autocomplete dropdown container? I have a situation where I have a postal code field, with an async search autocomplete that shows both the postal codes and the city names. When the dropdown initiates, the width seems to be getting set to the exact width of the input field, which in my case doesn't allow enough horizontal room to show the city names.

I found a kludgy workaround, by adding an update.mdb.autocomplete event handler that finds the autocomplete-downdown-container element and sets the width to "auto". Is there a better way?

*Expected behavior*Autocomplete dropdown width should be based on the width of the dropdown options, or specified

*Actual behavior*Dropdown width seems to be set to the pixel width of the associated input field

Resources (screenshots, code snippets etc.)picture of autocomplete dropdown


Kamila Pieńkowska staff answered 3 weeks ago

In your case, you prefer a dropdown to adjust to the content. For others, this is the opposite of what they need. Unfortunately, we needed to choose one version.

You can override autocomplete-dropdown-container width with CSS. Dropdown width is set based on input width, so alternatively, you can plan your input width to fit the postal code and City name.


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 9.0.0
  • Device: PC
  • Browser: chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: No