Skip to content

Commit 8c7ab17

Browse files
committed
make menu item enforce icon color when selected
1 parent 4644ffe commit 8c7ab17

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

packages/uui-menu-item/lib/uui-menu-item.element.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,9 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
546546
display: inline-flex;
547547
margin-right: var(--uui-size-2);
548548
}
549+
:host([selected]:not([select-mode='highlight'], [disabled])) #icon {
550+
--uui-icon-color-overwrite: currentColor;
551+
}
549552
550553
#badge {
551554
font-size: 12px;

packages/uui-menu-item/lib/uui-menu-item.story.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,21 @@ export const WidthBadge: Story = {
195195

196196
export const WithIcon: Story = {
197197
args: {
198+
selectable: true,
198199
'icon slot': html`<uui-icon slot="icon" name="favorite"></uui-icon>`,
199200
},
200201
};
201202

203+
export const WithColoredIcon: Story = {
204+
args: {
205+
selectable: true,
206+
'icon slot': html`<uui-icon
207+
slot="icon"
208+
name="favorite"
209+
style="--uui-icon-color: red"></uui-icon>`,
210+
},
211+
};
212+
202213
export const ItemIndentation: Story = {
203214
render: () => html`
204215
${MenuItems.map(

0 commit comments

Comments
 (0)