components icon indicating copy to clipboard operation
components copied to clipboard

[Mat-select] Support for dense list of mat-option's

Open ukon1990 opened this issue 8 years ago • 8 comments

Bug, feature request, or proposal:

I would like for you to add an attribute like with mat-list, that makes the list items denser. So basically <mat-select dense></mat-select>. If I try to reduce the height of the rows via css it gets all kinds of messed up with scrolling.

What is the expected behavior?

For the scrolling to work as it does with non default list item heights in mat-select for the mat-option's.

What is the current behavior?

If I press the letter I want to get down to, I end up in the wrong place if I change the height via css. You can see this in the image below. In this case I pressed the letter "U". mat-select-issue

This issue also occurs when I have selected something further down the list, and then re-clicks the mat-select element. Then I end up in the wrong place in the list. This is not too surprising, as I suspect that these are related to the each other.

The number of items in this list is 429 items.

What are the steps to reproduce?

.mat-option {
    line-height: 24px !important;
    height: 24px !important;
}

What is the use-case or motivation for changing an existing behavior?

My customer "demands" me to make it have less "air" as he calls it. And I too personally, would love to have the option. As I kind of agree that it shows less information per pixel (if I can say that).

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

All versions from v5 and up to me and all the regular browsers (Edge, Firefox, Chrome, Safari). For OS's I've tested in macOS and Windows. I expect this to be the issue on Linux, iOS and Android also.

My current package versions are:

Angular CLI: 6.0.3
Node: 9.9.0
OS: darwin x64
Angular: 6.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.3
@angular-devkit/build-angular     0.6.3
@angular-devkit/build-optimizer   0.6.3
@angular-devkit/core              0.6.3
@angular-devkit/schematics        0.6.3
@angular/cdk                      6.1.0
@angular/cli                      6.0.3
@angular/material                 6.1.0
@ngtools/webpack                  6.0.3
@schematics/angular               0.6.3
@schematics/update                0.6.3
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.8.3

Is there anything else we should know?

I would be truly greatful if this were something that were to be implemented.

ukon1990 avatar May 22 '18 18:05 ukon1990

I'm looking for something like this as well. But just one thought to the author of this issue though, for such a long list - wouldn't it be better UX to use a typeahead? Same would apply though, since matAutocomplete uses mat-options as well. :-)

OysteinAmundsen avatar Sep 12 '18 05:09 OysteinAmundsen

If there is a dense directive it should be on mat-option

yogeshgadge avatar Sep 12 '18 14:09 yogeshgadge

+1

ikourfaln avatar Sep 16 '18 15:09 ikourfaln

+1

njifares avatar Jun 13 '19 09:06 njifares

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

angular-robot[bot] avatar Feb 01 '22 18:02 angular-robot[bot]

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

angular-robot[bot] avatar Feb 22 '22 15:02 angular-robot[bot]

This should be possible using the styling APIs.

crisbeto avatar Nov 25 '25 10:11 crisbeto

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.