-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Bug, feature request, or proposal:
Proposal:
- Remove the
padding: 4px
of.mat-list-icon
.
Requests: - A list icon parent class with a fixed width.
- A separated icon background class for the list icon.
What is the expected behavior?
There are two specs for icon alignment: (1) using the raw icon and (2) using the icon inside a circle. In both, the space form the text to the left side of the list is the same (72dp). The only change is the icon width.
There is no padding on icon (1) ou (2) and the background is optional.
The first left pixel of the icon or the icon background is 16dp from the left of the list content.
Material specs:
https://material.io/guidelines/layout/structure.html#structure-side-nav
https://material.io/guidelines/components/lists.html#lists-specs
Example 1: layout_structure_sidenav_structure1
Example 2: components_lists_keylines_single5
Example 3: components_lists_keylines_two10
What is the current behavior?
md-list-icon
uses its own width as the space plus the icon and text paddings to create a 72dp width. This approach gives more than 16dp (currently it is 20dp) from icon to the left of the list content and the icon doesn't align with other vertical elements (like the user email on the specs above).
What are the steps to reproduce?
<!-- How to align the texts? -->
<md-list>
<md-list-item *ngFor="let message of messages">
<md-icon md-list-icon>folder</md-icon>
<h3 md-line> {{message.from}} </h3>
</md-list-item>
</md-list>
<md-list>
<md-list-item *ngFor="let message of messages">
<h3 md-line> {{message.from}} </h3>
</md-list-item>
</md-list>
<!-- Solution example -->
<md-list>
<md-list-item *ngFor="let message of messages">
<!-- Fixed spacer -->
<md-list-icon-spacer>
<!-- Icon can have a md-list-icon-bg for rounded background -->
<md-icon md-list-icon md-list-icon-bg>folder</md-icon>
</md-list-icon-spacer>
<h3 md-line> {{message.from}} </h3>
</md-list-item>
</md-list>
<md-list>
<md-list-item *ngFor="let message of messages">
<!-- Fixed spacer -->
<md-list-icon-spacer></md-list-icon-spacer>
<h3 md-line> {{message.from}} </h3>
</md-list-item>
</md-list>
What is the use-case or motivation for changing an existing behavior?
Create a sidenav with a user profile like the fist image above. Or align a list with icons with a list without icons.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Is there anything else we should know?
This needs to be considered for the right icon too. And on dense options.