Skip to content

Commit 76222ff

Browse files
committed
Adds href prop to menu-item
1 parent 217e1bc commit 76222ff

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/webviews/apps/shared/components/menu/menu-item.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,26 @@ export class MenuItem extends LitElement {
3737
color: var(--vscode-menu-selectionForeground);
3838
background-color: var(--vscode-menu-background);
3939
}
40+
41+
:host([href]) {
42+
padding-inline: 0;
43+
}
44+
45+
a {
46+
display: block;
47+
color: inherit;
48+
text-decoration: none;
49+
padding: 0 0.6rem;
50+
}
4051
`,
4152
];
4253

4354
@property({ type: Boolean, reflect: true })
4455
disabled = false;
4556

57+
@property({ reflect: true })
58+
href?: string;
59+
4660
@property({ reflect: true })
4761
override role = 'option';
4862

@@ -57,6 +71,9 @@ export class MenuItem extends LitElement {
5771
}
5872

5973
override render() {
74+
if (this.href) {
75+
return html`<a href=${this.href}><slot></slot></a>`;
76+
}
6077
return html`<slot></slot>`;
6178
}
6279
}

0 commit comments

Comments
 (0)