mirror of
https://github.com/material-components/material-web.git
synced 2026-03-09 00:09:23 +08:00
BREAKING CHANGE: `<md-list-item>` now uses slots instead of properties and has removed many prescriptive items (such as avatar, image, and video items). The default slot can be used for any custom content. ```html <md-list-item> <div slot="overline">OVERLINE</div> <div slot="headline">First line</div> <div slot="supporting-text">Second+ lines</div> <div slot="trailing-supporting-text">Trailing</div> <md-icon slot="start">star</md-icon> <md-icon slot="end">star</md-icon> </md-list-item> ``` Add `type="button"` or `type="link"` for interactive list items. PiperOrigin-RevId: 567732201
47 lines
1.0 KiB
SCSS
47 lines
1.0 KiB
SCSS
//
|
|
// Copyright 2022 Google LLC
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
// go/keep-sorted start
|
|
@use 'sass:list';
|
|
@use 'sass:map';
|
|
// go/keep-sorted end
|
|
// go/keep-sorted start
|
|
@use '../../tokens';
|
|
@use './listitem/list-item';
|
|
// go/keep-sorted end
|
|
|
|
@mixin theme($tokens) {
|
|
$supported-tokens: tokens.$md-comp-list-supported-tokens;
|
|
|
|
@each $token, $value in $tokens {
|
|
@if list.index($supported-tokens, $token) == null {
|
|
@error 'Token `#{$token}` is not a supported token.';
|
|
}
|
|
|
|
@if $value {
|
|
--md-list-#{$token}: #{$value};
|
|
}
|
|
}
|
|
}
|
|
|
|
@mixin styles() {
|
|
$tokens: tokens.md-comp-list-values();
|
|
@each $token, $value in $tokens {
|
|
$tokens: map.set($tokens, $token, var(--md-list-#{$token}, #{$value}));
|
|
}
|
|
|
|
:host {
|
|
background: map.get($tokens, 'container-color');
|
|
color: unset;
|
|
display: flex;
|
|
flex-direction: column;
|
|
outline: none;
|
|
padding: 8px 0;
|
|
// Add position so the elevation overlay (which is absolutely positioned)
|
|
// can be positioned relative to the list root.
|
|
position: relative;
|
|
}
|
|
}
|