File tree 3 files changed +29
-2
lines changed
3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 25
25
style =" {{ styles.icon }} "
26
26
class =" ui5-button-icon"
27
27
name =" {{ icon }} "
28
- show-tooltip ={{ iconOnly }}
28
+ show-tooltip ={{ showIconTooltip }}
29
29
></ui5-icon >
30
30
{{ /if }}
31
31
Original file line number Diff line number Diff line change @@ -110,6 +110,19 @@ const metadata = {
110
110
type : Boolean ,
111
111
} ,
112
112
113
+ /**
114
+ * Defines the tooltip of the button.
115
+ * <br>
116
+ * <b>Important:</b> Tooltips should only be set to icon only buttons.
117
+ * @type {string }
118
+ * @defaultvalue : ""
119
+ * @private
120
+ * @since 1.0.0-rc.11
121
+ */
122
+ title : {
123
+ type : String ,
124
+ } ,
125
+
113
126
/**
114
127
* Used to switch the active state (pressed or not) of the <code>ui5-button</code>.
115
128
* @private
@@ -187,6 +200,7 @@ const metadata = {
187
200
_iconSettings : {
188
201
type : Object ,
189
202
} ,
203
+
190
204
_buttonAccInfo : {
191
205
type : Object ,
192
206
} ,
@@ -370,7 +384,7 @@ class Button extends UI5Element {
370
384
"ariaExpanded" : this . ariaExpanded || ( this . _buttonAccInfo && this . _buttonAccInfo . ariaExpanded ) ,
371
385
"ariaControls" : this . _buttonAccInfo && this . _buttonAccInfo . ariaControls ,
372
386
"ariaHaspopup" : this . _buttonAccInfo && this . _buttonAccInfo . ariaHaspopup ,
373
- "title" : this . _buttonAccInfo && this . _buttonAccInfo . title ,
387
+ "title" : this . title || ( this . _buttonAccInfo && this . _buttonAccInfo . title ) ,
374
388
} ;
375
389
}
376
390
@@ -400,6 +414,10 @@ class Button extends UI5Element {
400
414
return this . nonFocusable ? "-1" : this . _tabIndex ;
401
415
}
402
416
417
+ get showIconTooltip ( ) {
418
+ return this . iconOnly && ! this . title ;
419
+ }
420
+
403
421
get styles ( ) {
404
422
return {
405
423
icon : {
Original file line number Diff line number Diff line change 188
188
< ui5-button class ="long-button " icon ="download "> Download</ ui5-button >
189
189
< ui5-button class ="long-button long-button-end " icon ="download "> Download</ ui5-button >
190
190
191
+ < br />
192
+ < br />
193
+ < ui5-title > Buttons with tooltip</ ui5-title >
194
+ < br />
195
+ < ui5-button icon ="home " title ="Go home "> </ ui5-button >
196
+ < ui5-button icon ="accept " title ="Accept terms & conditions "> </ ui5-button >
197
+ < ui5-button icon ="action-settings " title ="Go to settings "> </ ui5-button >
198
+ < ui5-button icon ="alert " title ="Fire an alert "> </ ui5-button >
199
+ < ui5-button icon ="arrow-down " title ="Go down "> </ ui5-button >
191
200
192
201
< script >
193
202
var clickCounter = document . querySelector ( "#click-counter" ) ;
You can’t perform that action at this time.
0 commit comments