Skip to content

Commit

Permalink
feat(chips): add filter chip selected-icon slot to customize checkmark
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 589186323
  • Loading branch information
asyncLiz authored and copybara-github committed Dec 8, 2023
1 parent c4cbd36 commit 89b4c2e
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions chips/internal/filter-chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ export class FilterChip extends MultiActionChip {
@property({type: Boolean}) removable = false;
@property({type: Boolean, reflect: true}) selected = false;

/**
* Only needed for SSR.
*
* Add this attribute when a filter chip has a `slot="selected-icon"` to avoid
* a Flash Of Unstyled Content.
*/
@property({type: Boolean, reflect: true, attribute: 'has-selected-icon'})
hasSelectedIcon = false;

protected get primaryId() {
return 'button';
}
Expand Down Expand Up @@ -65,10 +74,12 @@ export class FilterChip extends MultiActionChip {
}

return html`
<svg class="checkmark" viewBox="0 0 18 18" aria-hidden="true">
<path
d="M6.75012 12.1274L3.62262 8.99988L2.55762 10.0574L6.75012 14.2499L15.7501 5.24988L14.6926 4.19238L6.75012 12.1274Z" />
</svg>
<slot name="selected-icon">
<svg class="checkmark" viewBox="0 0 18 18" aria-hidden="true">
<path
d="M6.75012 12.1274L3.62262 8.99988L2.55762 10.0574L6.75012 14.2499L15.7501 5.24988L14.6926 4.19238L6.75012 12.1274Z" />
</svg>
</slot>
`;
}

Expand Down

0 comments on commit 89b4c2e

Please sign in to comment.