Skip to content

Commit 4098832

Browse files
committed
feat(button): add download filename support for link buttons
1 parent ac91657 commit 4098832

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

button/internal/button.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ export abstract class Button extends buttonBaseClass implements FormSubmitter {
6767
*/
6868
@property() href = '';
6969

70+
/**
71+
* The filename to use when downloading the linked resource.
72+
* If not specified, the browser will determine a filename.
73+
* This is only applicable when the button is used as a link (`href` is set).
74+
*/
75+
@property() downloadFilename = '';
76+
7077
/**
7178
* Where to display the linked `href` URL for a link button. Common options
7279
* include `_blank` to open in a new tab.
@@ -184,6 +191,7 @@ export abstract class Button extends buttonBaseClass implements FormSubmitter {
184191
aria-haspopup="${ariaHasPopup || nothing}"
185192
aria-expanded="${ariaExpanded || nothing}"
186193
href=${this.href}
194+
download=${this.downloadFilename || nothing}
187195
target=${this.target || nothing}
188196
>${this.renderContent()}
189197
</a>`;

0 commit comments

Comments
 (0)