Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/uui-icon/lib/uui-icon.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
* @element uui-icon
* @fires {UUIIconRequestEvent} icon_request - fires when the name property is defined to retrieve the icon source.
* @description - Icon component for displaying icons.
* @cssprop --uui-icon-color - overwrite the icon color.
* @cssprop --uui-icon-color - sets the color for the icon, if not set it will use the text color.
* @cssprop --uui-icon-color-overwrite - overwrite the icon color, once this is set the --uui-icon-color will be ignored.
* @see UUIIconRegistryElement Ideally used together with a icon registry.
*/
@defineElement('uui-icon')
Expand Down Expand Up @@ -149,7 +150,10 @@ export class UUIIconElement extends LitElement {

:host svg,
::slotted(svg) {
color: var(--uui-icon-color, currentColor);
color: var(
--uui-icon-color-overwrite,
var(--uui-icon-color, currentColor)
);
width: 100%;
}

Expand Down
3 changes: 3 additions & 0 deletions packages/uui-menu-item/lib/uui-menu-item.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,9 @@ export class UUIMenuItemElement extends SelectOnlyMixin(
display: inline-flex;
margin-right: var(--uui-size-2);
}
:host([selected]:not([select-mode='highlight'], [disabled])) #icon {
--uui-icon-color-overwrite: currentColor;
}

#badge {
font-size: 12px;
Expand Down
11 changes: 11 additions & 0 deletions packages/uui-menu-item/lib/uui-menu-item.story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,21 @@ export const WidthBadge: Story = {

export const WithIcon: Story = {
args: {
selectable: true,
'icon slot': html`<uui-icon slot="icon" name="favorite"></uui-icon>`,
},
};

export const WithColoredIcon: Story = {
args: {
selectable: true,
'icon slot': html`<uui-icon
slot="icon"
name="favorite"
style="--uui-icon-color: red"></uui-icon>`,
},
};

export const ItemIndentation: Story = {
render: () => html`
${MenuItems.map(
Expand Down
Loading