Skip to content

Commit

Permalink
Merge pull request #5939 from nextcloud-libraries/backport/5938/next
Browse files Browse the repository at this point in the history
[next] feat(NcButton): Allow to specify `target` attribute for buttons with href
  • Loading branch information
susnux committed Aug 30, 2024
2 parents 5801575 + b553e36 commit 238679f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/NcButton/NcButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,15 @@ export default defineComponent({
default: null,
},
/**
* Target for the `a` element if `href` is set.
* @default '_self'
*/
target: {
type: String,
default: '_self',
},
/**
* Providing the download attribute with href downloads file when clicking.
*/
Expand Down Expand Up @@ -652,7 +661,7 @@ export default defineComponent({
type: isLink ? null : this.nativeType,
role: isLink ? 'button' : null,
href: this.to ? href : (this.href || null),
target: isLink ? '_self' : null,
target: isLink ? this.target : null,
rel: isLink ? 'nofollow noreferrer noopener' : null,
download: (!this.to && this.href && this.download) ? this.download : null,
// If this button is used as a popover trigger, we need to apply trigger attrs, e.g. aria attributes
Expand Down

0 comments on commit 238679f

Please sign in to comment.