@@ -92,14 +92,35 @@ $mat-list-item-inset-divider-offset: 72px;
92
92
93
93
.mat-list-text {
94
94
@include mat-line-wrapper-base ();
95
- padding : 0 $mat-list-side-padding ;
96
95
97
- // We only want to override the padding if there isn't
98
- // an avatar or icon before the element. Since the ripple
99
- // will always be the first child in the container, we
100
- // check whether this element is the second child.
101
- & :nth-child (2 ) {
102
- padding : 0 ;
96
+ // By default, there will be no padding for the list item text because the padding is already
97
+ // set on the `mat-list-item-content` element. Later, if the list-item detects that there are
98
+ // secondary items (avatar, checkbox), a padding on the proper side will be added.
99
+ padding : 0 ;
100
+ }
101
+
102
+ // There can be a secondary item (e.g. avatar-icon, checkbox) at the start of the
103
+ // list-item. This means that there should be a padding for the mat-list-text on the start-side.
104
+ .mat-list-item-content .mat-list-text :not (:nth-child (2 )) {
105
+ padding-right : 0 ;
106
+ padding-left : $mat-list-side-padding ;
107
+
108
+ [dir = ' rtl' ] & {
109
+ padding-right : $mat-list-side-padding ;
110
+ padding-left : 0 ;
111
+ }
112
+ }
113
+
114
+ // Reversed content is mainly used by the MatSelectionList for displaying the checkbox at the
115
+ // end of the list option. Since there is a secondary item (checkbox) at the end of the
116
+ // option, there needs to be a padding for the mat-list-text on the end-side.
117
+ .mat-list-item-content-reverse .mat-list-text :not (:nth-child (2 )) {
118
+ padding-left : 0 ;
119
+ padding-right : $mat-list-side-padding ;
120
+
121
+ [dir = ' rtl' ] & {
122
+ padding-right : 0 ;
123
+ padding-left : $mat-list-side-padding ;
103
124
}
104
125
}
105
126
0 commit comments