Skip to content

Commit 49a6be1

Browse files
committed
feat(chip): trailing remove icon can now be customized
1 parent 76883cd commit 49a6be1

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

chips/internal/_trailing-icon.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@
3535
width: var(--_icon-size);
3636
}
3737

38-
[name="remove-trailing-icon"]::slotted(md-icon) {
39-
--md-icon-size: var(--_icon-size);
40-
color: inherit;
41-
}
42-
4338
:where(:hover) .trailing.icon {
4439
color: var(--_hover-trailing-icon-color);
4540
}

chips/internal/chip.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export abstract class Chip extends LitElement {
8787
<div class="container ${classMap(this.getContainerClasses())}">
8888
${this.renderContainerContent()}
8989
</div>
90+
<slot></slot>
9091
`;
9192
}
9293

chips/internal/trailing-icons.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import '../../ripple/ripple.js';
99

1010
import {html, nothing} from 'lit';
1111

12-
import {MultiActionChip} from './multi-action-chip.js';
12+
import {Chip} from './chip.js';
1313

1414
interface RemoveButtonProperties {
1515
ariaLabel: string;
@@ -34,18 +34,20 @@ export function renderRemoveButton({
3434
@focus=${focusListener}>
3535
<md-focus-ring part="trailing-focus-ring"></md-focus-ring>
3636
<md-ripple ?disabled=${disabled}></md-ripple>
37-
<slot name="remove-trailing-icon" class="trailing icon">
38-
<svg viewBox="0 96 960 960" aria-hidden="true">
39-
<path
40-
d="m249 849-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z" />
41-
</svg>
42-
</slot>
37+
<span class="trailing icon">
38+
<slot name="remove-trailing-icon">
39+
<svg viewBox="0 96 960 960" aria-hidden="true">
40+
<path
41+
d="m249 849-42-42 231-231-231-231 42-42 231 231 231-231 42 42-231 231 231 231-42 42-231-231-231 231Z" />
42+
</svg>
43+
</slot>
44+
</span>
4345
<span class="touch"></span>
4446
</button>
4547
`;
4648
}
4749

48-
function handleRemoveClick(this: MultiActionChip, event: Event) {
50+
function handleRemoveClick(this: Chip, event: Event) {
4951
if (this.disabled) {
5052
return;
5153
}

0 commit comments

Comments
 (0)