Skip to content

Commit 89b4c2e

Browse files
asyncLizcopybara-github
authored andcommitted
feat(chips): add filter chip selected-icon slot to customize checkmark
PiperOrigin-RevId: 589186323
1 parent c4cbd36 commit 89b4c2e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

chips/internal/filter-chip.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ export class FilterChip extends MultiActionChip {
2525
@property({type: Boolean}) removable = false;
2626
@property({type: Boolean, reflect: true}) selected = false;
2727

28+
/**
29+
* Only needed for SSR.
30+
*
31+
* Add this attribute when a filter chip has a `slot="selected-icon"` to avoid
32+
* a Flash Of Unstyled Content.
33+
*/
34+
@property({type: Boolean, reflect: true, attribute: 'has-selected-icon'})
35+
hasSelectedIcon = false;
36+
2837
protected get primaryId() {
2938
return 'button';
3039
}
@@ -65,10 +74,12 @@ export class FilterChip extends MultiActionChip {
6574
}
6675

6776
return html`
68-
<svg class="checkmark" viewBox="0 0 18 18" aria-hidden="true">
69-
<path
70-
d="M6.75012 12.1274L3.62262 8.99988L2.55762 10.0574L6.75012 14.2499L15.7501 5.24988L14.6926 4.19238L6.75012 12.1274Z" />
71-
</svg>
77+
<slot name="selected-icon">
78+
<svg class="checkmark" viewBox="0 0 18 18" aria-hidden="true">
79+
<path
80+
d="M6.75012 12.1274L3.62262 8.99988L2.55762 10.0574L6.75012 14.2499L15.7501 5.24988L14.6926 4.19238L6.75012 12.1274Z" />
81+
</svg>
82+
</slot>
7283
`;
7384
}
7485

0 commit comments

Comments
 (0)