Skip to content
Merged
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
13 changes: 12 additions & 1 deletion packages/uui-button/lib/uui-button.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ export class UUIButtonElement extends UUIFormControlMixin(
@property({ type: String })
public rel?: string;

/**
* Sets the title attribute, which provides a tooltip for both button and anchor elements.
* @type {string}
* @attr
* @default ''
*/
@property({ type: String })
public title: string = '';

@query('#button')
protected _button!: HTMLInputElement;

Expand Down Expand Up @@ -237,6 +246,7 @@ export class UUIButtonElement extends UUIFormControlMixin(
<a
id="button"
aria-label=${ifDefined(this.label)}
title=${ifDefined(this.title === '' ? undefined : this.title)}
href=${ifDefined(!this.disabled ? this.href : undefined)}
target=${ifDefined(this.target || undefined)}
rel=${ifDefined(
Expand All @@ -254,7 +264,8 @@ export class UUIButtonElement extends UUIFormControlMixin(
id="button"
type=${this.type}
?disabled=${this.disabled}
aria-label=${ifDefined(this.label)}>
aria-label=${ifDefined(this.label)}
title=${ifDefined(this.title === '' ? undefined : this.title)}>
${this.renderState()} ${this.renderLabel()}
<slot name="extra"></slot>
</button>
Expand Down
Loading