File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed
Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 2525 style =" {{ styles.icon }} "
2626 class =" ui5-button-icon"
2727 name =" {{ icon }} "
28- show-tooltip ={{ iconOnly }}
28+ show-tooltip ={{ showIconTooltip }}
2929 ></ui5-icon >
3030 {{ /if }}
3131
Original file line number Diff line number Diff line change @@ -110,6 +110,19 @@ const metadata = {
110110 type : Boolean ,
111111 } ,
112112
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+
113126 /**
114127 * Used to switch the active state (pressed or not) of the <code>ui5-button</code>.
115128 * @private
@@ -187,6 +200,7 @@ const metadata = {
187200 _iconSettings : {
188201 type : Object ,
189202 } ,
203+
190204 _buttonAccInfo : {
191205 type : Object ,
192206 } ,
@@ -370,7 +384,7 @@ class Button extends UI5Element {
370384 "ariaExpanded" : this . ariaExpanded || ( this . _buttonAccInfo && this . _buttonAccInfo . ariaExpanded ) ,
371385 "ariaControls" : this . _buttonAccInfo && this . _buttonAccInfo . ariaControls ,
372386 "ariaHaspopup" : this . _buttonAccInfo && this . _buttonAccInfo . ariaHaspopup ,
373- "title" : this . _buttonAccInfo && this . _buttonAccInfo . title ,
387+ "title" : this . title || ( this . _buttonAccInfo && this . _buttonAccInfo . title ) ,
374388 } ;
375389 }
376390
@@ -400,6 +414,10 @@ class Button extends UI5Element {
400414 return this . nonFocusable ? "-1" : this . _tabIndex ;
401415 }
402416
417+ get showIconTooltip ( ) {
418+ return this . iconOnly && ! this . title ;
419+ }
420+
403421 get styles ( ) {
404422 return {
405423 icon : {
Original file line number Diff line number Diff line change 188188 < ui5-button class ="long-button " icon ="download "> Download</ ui5-button >
189189 < ui5-button class ="long-button long-button-end " icon ="download "> Download</ ui5-button >
190190
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 >
191200
192201 < script >
193202 var clickCounter = document . querySelector ( "#click-counter" ) ;
You can’t perform that action at this time.
0 commit comments