diff --git a/src/dev-app/list/list-demo.html b/src/dev-app/list/list-demo.html
index 6886c33806cf..16fcdf8af0d0 100644
--- a/src/dev-app/list/list-demo.html
+++ b/src/dev-app/list/list-demo.html
@@ -110,7 +110,7 @@
Dense lists
Nav lists
@for (link of links; track link) {
-
+
{{ link.name }}
}
@@ -120,7 +120,7 @@ Nav lists
}
@for (link of links; track link; let last = $last) {
-
+
folder
{{ link.name }}
diff --git a/src/dev-app/list/list-demo.ts b/src/dev-app/list/list-demo.ts
index 30ff2459576f..ddd2f7c93f5d 100644
--- a/src/dev-app/list/list-demo.ts
+++ b/src/dev-app/list/list-demo.ts
@@ -13,6 +13,11 @@ import {MatListModule, MatListOptionTogglePosition} from '@angular/material/list
import {MatIconModule} from '@angular/material/icon';
import {CommonModule} from '@angular/common';
+interface Link {
+ name: string;
+ href: string;
+}
+
@Component({
selector: 'list-demo',
templateUrl: 'list-demo.html',
@@ -52,7 +57,7 @@ export class ListDemo {
},
];
- links: {name: string; href: string}[] = [
+ links: Link[] = [
{name: 'Inbox', href: '/list#inbox'},
{name: 'Outbox', href: '/list#outbox'},
{name: 'Spam', href: '/list#spam'},
@@ -85,7 +90,7 @@ export class ListDemo {
alert(msg);
}
- isActivated(href: string) {
- return window.location.href === new URL(href, window.location.href).toString();
+ isActivated(link: Link) {
+ return `${window.location.pathname}${window.location.hash}` === link.href;
}
}
diff --git a/src/material-experimental/theming/_custom-tokens.scss b/src/material-experimental/theming/_custom-tokens.scss
index ffcdac5398a6..9e0ced8efbe7 100644
--- a/src/material-experimental/theming/_custom-tokens.scss
+++ b/src/material-experimental/theming/_custom-tokens.scss
@@ -657,6 +657,17 @@
));
}
+/// Generates custom tokens for the mat-list.
+/// @param {Map} $systems The MDC system tokens
+/// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
+/// @return {Map} A set of custom tokens for the mat-list
+@function list($systems, $exclude-hardcoded) {
+ @return (
+ active-indicator-color: map.get($systems, md-sys-color, secondary-container),
+ active-indicator-shape: map.get($systems, md-sys-shape, corner-full),
+ );
+}
+
/// Generates custom tokens for the mat-button.
/// @param {Map} $systems The MDC system tokens
/// @param {Boolean} $exclude-hardcoded Whether to exclude hardcoded token values
diff --git a/src/material-experimental/theming/_m3-tokens.scss b/src/material-experimental/theming/_m3-tokens.scss
index edff599becbf..e6f5ee74fff9 100644
--- a/src/material-experimental/theming/_m3-tokens.scss
+++ b/src/material-experimental/theming/_m3-tokens.scss
@@ -836,6 +836,11 @@
custom-tokens.filled-button($systems, $exclude-hardcoded),
$token-slots
),
+ _namespace-tokens(
+ (mat, list),
+ custom-tokens.list($systems, $exclude-hardcoded),
+ $token-slots
+ ),
_namespace-tokens(
// Note: in M3 the "protected" button is called "elevated".
(mat, protected-button),
diff --git a/src/material/core/tokens/m2/mat/_list.scss b/src/material/core/tokens/m2/mat/_list.scss
index f53d06515d51..c6fb8c2f0d19 100644
--- a/src/material/core/tokens/m2/mat/_list.scss
+++ b/src/material/core/tokens/m2/mat/_list.scss
@@ -7,7 +7,11 @@ $prefix: (mat, list);
// Tokens that can't be configured through Angular Material's current theming API,
// but may be in a future version of the theming API.
@function get-unthemable-tokens() {
- @return ();
+ @return (
+ // active indicator themable with M3
+ active-indicator-color: transparent,
+ active-indicator-shape: 0,
+ );
}
// Tokens that can be configured through Angular Material's color theming API.
diff --git a/src/material/list/list.scss b/src/material/list/list.scss
index 7354c78700b9..7db5448a414e 100644
--- a/src/material/list/list.scss
+++ b/src/material/list/list.scss
@@ -206,4 +206,12 @@ mat-action-list button {
@include token-utils.create-token-slot(margin-inline-start, list-item-leading-icon-start-space);
@include token-utils.create-token-slot(margin-inline-end, list-item-leading-icon-end-space);
}
+
+ a.mdc-list-item.mdc-list-item--activated {
+ @include token-utils.create-token-slot(background-color, active-indicator-color);
+ // active-indicator-shape overrides list-item-container-shape
+ &.mdc-list-item {
+ @include token-utils.create-token-slot(border-radius, active-indicator-shape);
+ }
+ }
}