You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Request : md-option autoHeight support for <md-select> and/or <md-autocomplete> #4071
P5The team acknowledges the request but does not plan to address it, it remains open for discussionarea: material/selectfeatureLabel used to distinguish feature request from other issues
option to choose between fixed height or auto-height to fit md-option's contents.
What is the current behavior?
md-option's height is fixed to 48px
What is the use-case or motivation for changing an existing behavior?
its very helpful and descriptive to have an additional text (maybe in smaller font-size) to show more information in the options, rather than having one line of text which only show one information.
Currently on :
Angular material 2.0.0-beta.3
Reacted by Kevin Russon, Harel M, Anthony Ciccarello, Almar Schouten, Ali Altun, james-schwartzkopf, Alex Bjørlig, coder925, Øivind Thorvaldsen Elfving, Emerson Dallagnol and 7 more
changed the title [-]Request : Auto-Grow md-option support for <md-select> and <md-autocomplete>[/-][+]Request : md-option NewLine support for <md-select> and <md-autocomplete>[/+]on Apr 13, 2017
changed the title [-]Request : md-option NewLine support for <md-select> and <md-autocomplete>[/-][+]Request : md-option autoHeight support for <md-select> and/or <md-autocomplete>[/+]on Apr 13, 2017
@jelbourn yes it will be great to have it for autocomplete, I believe many Web Apps will rely heavily on autocomplete to select and filter hundreds of options (and I don't think md-select is the right component for that -- since it has no textbox to type and find options)
@gedclack you are only saying that under the assumption that md-select can not do that, which it certainly can and there is pending (for two months) PR for it already #3211
In fact, I think autocomplete is definitely NOT the right component for selecting, that's what select is for, as autocomplete doesn't by default (and currently not even with option) enforce the selection to be the one of the list, it simply does the completion.
Also @jelbourn it will only be more difficult if you do that the actual "autoheight", if you allow the user to set the default (fixed) height, instead of hardcoding it, or do something like md-line on md-list, it shouldn't be difficult at all.
and
Based on the material design spec, we don't see multi-line options for being permitted
I don't see it being prohibited either, but if it is the case, allowing the user to set the fixed height of all items should still be considered.
That's not gonna work. The height is internally hardwired so they can calculate position of the active item upon opening. Overriding the height just in css is going to mess it up.
(material applies 'mat-multi-line' class when there are more than 3 matLine) (IMHO we probably need something like MatFitContent directive on mat-list-item that does the same)
Reacted by Øivind Thorvaldsen Elfving, Emerson Dallagnol, studds, Jon Zgoda, Jordan Sherman, enderozcan, Chris Pan, Mehdi Saeedifar and Lukáš "striky" Strišovský
Reacted by GedClack, Øivind Thorvaldsen Elfving and Chris Pan
This is supported in the MDC-based version of mat-autocomplete and mat-select from @angular/material-experimental. I'll close this issue, because porting the feature back to the non-MDC version won't be practical.
P5The team acknowledges the request but does not plan to address it, it remains open for discussionarea: material/selectfeatureLabel used to distinguish feature request from other issues
Activity
[-]Request : Auto-Grow md-option support for <md-select> and <md-autocomplete>[/-][+]Request : md-option NewLine support for <md-select> and <md-autocomplete>[/+][-]Request : md-option NewLine support for <md-select> and <md-autocomplete>[/-][+]Request : md-option autoHeight support for <md-select> and/or <md-autocomplete>[/+]willshowell commentedon Apr 13, 2017
Possible duplicate of #3883
jelbourn commentedon Apr 13, 2017
Potentially doable for autocomplete, would be much more difficult for select.
gedclack commentedon Apr 15, 2017
@jelbourn yes it will be great to have it for autocomplete, I believe many Web Apps will rely heavily on autocomplete to select and filter hundreds of options (and I don't think
md-selectis the right component for that -- since it has no textbox to type and find options)fxck commentedon Apr 16, 2017
@gedclack you are only saying that under the assumption that md-select can not do that, which it certainly can and there is pending (for two months) PR for it already #3211
In fact, I think autocomplete is definitely NOT the right component for selecting, that's what select is for, as autocomplete doesn't by default (and currently not even with option) enforce the selection to be the one of the list, it simply does the completion.
Also @jelbourn it will only be more difficult if you do that the actual "autoheight", if you allow the user to set the default (fixed) height, instead of hardcoding it, or do something like md-line on md-list, it shouldn't be difficult at all.
and
I don't see it being prohibited either, but if it is the case, allowing the user to set the fixed height of all items should still be considered.
gedclack commentedon Apr 17, 2017
@fxck well it will be great then 👍 , I am just assuming with the current version of Material2.
@jelbourn IMHO (and with current version of Material2), if you add this #3334 that will be the solution for #3211
PeS82 commentedon May 24, 2017
I believe having the possibility to use
ng-templateinstead ofmd-optionin options list formd-autocompletewould be nice. Please?gedclack commentedon Jul 20, 2017
@jelbourn is this resolved in the recent updates?
*haven't touch angular projects for a few weeks now..
ksmirnoff commentedon Oct 8, 2017
@jelbourn is there an ETA for providing multiline support for autocomplete suggestion panel?
amitport commentedon Oct 23, 2017
I'm using this workaround and it works fine for now:
fxck commentedon Oct 23, 2017
That's not gonna work. The height is internally hardwired so they can calculate position of the active item upon opening. Overriding the height just in css is going to mess it up.
amitport commentedon Oct 23, 2017
@fxck it worked well enough for my use case. That being said, it's definitely not a solution and this issue should be open.
In any case, a have another workaround that should play nicer with other css rules:
(material applies 'mat-multi-line' class when there are more than 3 matLine) (IMHO we probably need something like MatFitContent directive on mat-list-item that does the same)
fxck commentedon Oct 23, 2017
Also apparently you are talking about mat-list, while this issue is about mat-autocomplete and mat-select.
amitport commentedon Oct 23, 2017
@fxck ohh... you're right, sorry, I thought I was writing in #4114 (which should be re-opened IMO)
faelmorais commentedon Feb 9, 2018
Any updates on this function?
charlie-elverson commentedon Jun 27, 2018
This takes care of my needs for displaying multiple lines of content in a single mat-option.
<mat-option *ngFor="let emp of empDataSource | async" style="height: 90px;" [value]="emp"> {{emp.searchDisplay}} <br> Building: {{emp.thing1}} <br> Room: {{emp.thing2}} </mat-option>leogoesger commentedon Nov 5, 2018
Could someone provide an update on this? What would the proper syntax for using
mat-optionifdisplayed value is too long?
martin-dmtrv commentedon Dec 20, 2019
Adding this style to
mat-optionappears to solve the problem for us:style="min-height: 48px; line-height: normal; height: auto; padding: 10px 20px;"So final component should like something like:
striky1 commentedon Mar 20, 2020
I'm using @martin-dmtrv solution but with these styles:
min-height: 48px; line-height: 1.15; height: auto; padding: 8px 16px; white-space: normal;Which more following base Material styles.
Jadamae77 commentedon Jun 3, 2020
Any updates?
gedclack commentedon Jun 15, 2020
for now I'm using similar workaround, adding this css below and using it on my AutoComplete's
<mat-option>crisbeto commentedon Apr 23, 2021
This is supported in the MDC-based version of
mat-autocompleteandmat-selectfrom@angular/material-experimental. I'll close this issue, because porting the feature back to the non-MDC version won't be practical.angular-automatic-lock-bot commentedon May 24, 2021
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.