{"id":33947,"date":"2019-03-04T09:24:51","date_gmt":"2019-03-04T09:24:51","guid":{"rendered":"http:\/\/getshortcodes.com\/?post_type=docs&#038;p=33947"},"modified":"2023-05-27T08:52:14","modified_gmt":"2023-05-27T08:52:14","slug":"tooltip","status":"publish","type":"docs","link":"https:\/\/getshortcodes.com\/docs\/tooltip\/","title":{"rendered":"Tooltip"},"content":{"rendered":"<div class=\"block-demo block-demo-default\">\n\t<div class=\"block-demo-viewport\">\n\t\t<p><span id=\"su_tooltip_69e775dc89681_button\" class=\"su-tooltip-button su-tooltip-button-outline-yes\" aria-describedby=\"su_tooltip_69e775dc89681\" data-settings='{\"position\":\"top\",\"behavior\":\"hover\",\"hideDelay\":0}' tabindex=\"0\"> Hover me to open tooltip <\/span><span style=\"display:none;z-index:100\" id=\"su_tooltip_69e775dc89681\" class=\"su-tooltip\" role=\"tooltip\"><span class=\"su-tooltip-inner su-tooltip-shadow-no\" style=\"z-index:100;background:#222222;color:#FFFFFF;font-size:16px;border-radius:5px;text-align:left;max-width:300px;line-height:1.25\"><span class=\"su-tooltip-title\">Tooltip title<\/span><span class=\"su-tooltip-content su-u-trim\">Tooltip content<\/span><\/span><span id=\"su_tooltip_69e775dc89681_arrow\" class=\"su-tooltip-arrow\" style=\"z-index:100;background:#222222\" data-popper-arrow><\/span><\/span><\/p>\n\t<\/div>\n\t<div class=\"block-demo-source\">\n\t\t<pre contenteditable=\"true\"><\/pre>\n\t<\/div>\n<\/div>\n\n\n<p class=\"h2\">Table of contents<\/p>\n\n<ol><li><a href=\"#description\">Description<\/a><\/li><li><a href=\"#options\">Options<\/a><\/li><li><a href=\"#links-within-tooltips\">Links within tooltips<\/a><\/li><li><a href=\"#reference-element\">Reference element<\/a><\/li><\/ol><\/li><\/ol>\n\n\n<h2 class=\"wp-block-heading\" id=\"description\">Description<\/h2>\n\n\n\n<p>This shortcode allows you to create colorful tooltips on almost any element. The tooltip can be shown on mouse over or on click.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"options\">Options<\/h2>\n\n\n\n<figure class=\"wp-block-table c-shortcode-options\"><table><tbody><tr><td>title<\/td><td>Title of the tooltip. Use empty value to hide the title. Supports nested shortcodes (<a rel=\"noreferrer noopener\" href=\"\/docs\/nested-shortcodes-shortcodes-in-attributes\/#use-of-shortcodes-inside-the-attributes-of-other-shortcodes\" target=\"_blank\">learn more<\/a>)<\/td><\/tr><tr><td>text<\/td><td>Content of the tooltip. Supports nested shortcodes (<a rel=\"noreferrer noopener\" href=\"\/docs\/nested-shortcodes-shortcodes-in-attributes\/#use-of-shortcodes-inside-the-attributes-of-other-shortcodes\" target=\"_blank\">learn more<\/a>)<br><br><strong>Default value:<\/strong> <code>Tooltip content<\/code><\/td><\/tr><tr><td>position<\/td><td>Tooltip position. The position of the tooltip may be automatically adjusted depending on the size of the browser viewport and scroll<br><br><strong>Possible values:<\/strong><br><code>top<\/code><br><code>bottom<\/code><br><code>left<\/code><br><code>right<\/code><br><br><strong>Default value:<\/strong> <code>top<\/code><\/td><\/tr><tr><td>background<\/td><td>Tooltip background color<br><br><strong>Possible values:<\/strong> #HEX color<br><br><strong>Default value:<\/strong> <code>#222222<\/code><\/td><\/tr><tr><td>color<\/td><td>Tooltip text color<br><br><strong>Possible values:<\/strong> #HEX color<br><br><strong>Default value:<\/strong> <code>#FFFFFF<\/code><\/td><\/tr><tr><td>font_size<\/td><td>The font size of the tooltip title\/content, in pixels. This parameter also affects the padding of the tooltip.<br><br><strong>Possible values:<\/strong> Number from 10 to 24<br><br><strong>Default value:<\/strong> <code>16<\/code><\/td><\/tr><tr><td>text_align<\/td><td>The alignment of the tooltip content<br><br><strong>Possible values:<\/strong> <code>left<\/code>, <code>center<\/code>, <code>right<\/code><br><br><strong>Default value:<\/strong> <code>left<\/code><\/td><\/tr><tr><td>max_width<\/td><td>The maximum width of the tooltip, in pixels<br><br><strong>Possible values:<\/strong> Number from 10 to 1000<br><br><strong>Default value:<\/strong> <code>300<\/code><\/td><\/tr><tr><td>radius<\/td><td>The radius of the tooltip corners, in pixels. Use 0 to make corners square<br><br><strong>Possible values:<\/strong> Number from 0 to 20<br><br><strong>Default value:<\/strong> <code>5<\/code><\/td><\/tr><tr><td>shadow<\/td><td>This option enables tooltip shadow<br><br><strong>Possible values:<\/strong> <code>yes<\/code> or <code>no<\/code><br><br><strong>Default value:<\/strong> <code>no<\/code><\/td><\/tr><tr><td>behavior<\/td><td>This option determines how the tooltip will be opened<br><br><strong>Possible values:<\/strong> <code>hover<\/code>, <code>click<\/code>, <code>always<\/code><br><br><strong>Default value:<\/strong> <code>hover<\/code><\/td><\/tr><tr><td>class<\/td><td>Additional CSS class name(s) separated by space(s)<\/td><\/tr><tr><td>outline<\/td><td>This option allows you to disable the outline of the <a href=\"#what-is-reference-element\"><\/a><a href=\"#reference-element\">reference element<\/a> when it&#8217;s focused. Default value: <code>yes<\/code> which means the outline will be visible. Possible values are <code>yes<\/code> and <code>no<\/code>. Disabling of the outline is strongly discouraged, since it makes keyboard navigation a poor experience. Reference element is an element which you hover\/click to display the tooltip.<\/td><\/tr><tr><td>tabindex<\/td><td>This option enables the <code>tabindex<\/code> attribute on the <a href=\"#what-is-reference-element\"><\/a><a href=\"#reference-element\">reference element<\/a> to make it accessible from keyboard. Default value is <code>yes<\/code> which means the <code>tabindex=\"0\"<\/code> will be added to the tooltip reference element. Possible values are <code>yes<\/code> and <code>no<\/code>. Disable this is strongly discouraged, since it will make your tooltip content not accessible from keyboard.<\/td><\/tr><tr><td>reference_tag<\/td><td>This option defines the <a href=\"#reference-element\">reference element<\/a> tag name. Default value is <code>span<\/code>. Possible values are HTML tag names, like <code>em<\/code>, <code>strong<\/code> and so on. It&#8217;s not recommended to use names of block-level elements, like <code>div<\/code>.<\/td><\/tr><tr><td>line_height<\/td><td>Line height of the tooltip content. Default value is <code>1.25<\/code>.<\/td><\/tr><tr><td>hide_delay<\/td><td>The delay before closing the tooltip, in milliseconds. This parameter can be used to allow users to click links within the open tooltip. See an example below.<\/td><\/tr><tr><td>z_index<\/td><td>This option allows you to adjust the value of the z-index property for the tooltip element. Can be useful if a tooltip is hidden behind some element on your page. Default value is <code>100<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"links-within-tooltips\">Links within tooltips<\/h2>\n\n\n\n<p>You can easily add a link within a tooltip. This combination has the following requirements:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You&#8217;ll need to replace double quotes of the shortcode with single quotes (<code>\" &gt; '<\/code>)<\/li>\n\n\n\n<li>Tooltip with a link can only use the following values for the <code>behavior<\/code> attribute: <code>always<\/code>, <code>click<\/code><\/li>\n\n\n\n<li>You&#8217;ll need to add a <code>hide_delay<\/code> greater than <code>0<\/code><\/li>\n<\/ul>\n\n\n\n<p>See an example code below.<\/p>\n\n\n<div class=\"block-demo block-demo-default\">\n\t<div class=\"block-demo-viewport\">\n\t\t<p><span id=\"su_tooltip_69e775dc89a86_button\" class=\"su-tooltip-button su-tooltip-button-outline-yes\" aria-describedby=\"su_tooltip_69e775dc89a86\" data-settings='{\"position\":\"bottom\",\"behavior\":\"click\",\"hideDelay\":1000}' tabindex=\"0\"> Show tooltip with a link <\/span><span style=\"display:none;z-index:100\" id=\"su_tooltip_69e775dc89a86\" class=\"su-tooltip\" role=\"tooltip\"><span class=\"su-tooltip-inner su-tooltip-shadow-yes\" style=\"z-index:100;background:#ffffff;color:#000000;font-size:14px;border-radius:5px;text-align:left;max-width:300px;line-height:1.25\"><span class=\"su-tooltip-title\"><\/span><span class=\"su-tooltip-content su-u-trim\">Tooltip content.<br \/><a href=\"https:\/\/example.com\/\" target=\"_blank\" rel=\"noopener\">Learn more<\/a><\/span><\/span><span id=\"su_tooltip_69e775dc89a86_arrow\" class=\"su-tooltip-arrow\" style=\"z-index:100;background:#ffffff\" data-popper-arrow><\/span><\/span><\/p>\n\t<\/div>\n\t<div class=\"block-demo-source\">\n\t\t<pre contenteditable=\"true\"><span id=\"su_tooltip_69e775dc89fe8_button\" class=\"su-tooltip-button su-tooltip-button-outline-yes\" aria-describedby=\"su_tooltip_69e775dc89fe8\" data-settings='{\"position\":\"039bottom039\",\"behavior\":\"039click039\",\"hideDelay\":0}' tabindex=\"0\"> Show tooltip with a link <\/span><span style=\"display:none;z-index:100\" id=\"su_tooltip_69e775dc89fe8\" class=\"su-tooltip\" role=\"tooltip\"><span class=\"su-tooltip-inner su-tooltip-shadow-039yes039\" style=\"z-index:100;background:&#039;#ffffff&#039;;color:&#039;#000000&#039;;font-size:&#039;14&#039;;border-radius:5px;text-align:left;max-width:300px;line-height:1.25\"><span class=\"su-tooltip-title\"><\/span><span class=\"su-tooltip-content su-u-trim\">&#039;Tooltip<\/span><\/span><span id=\"su_tooltip_69e775dc89fe8_arrow\" class=\"su-tooltip-arrow\" style=\"z-index:100;background:&#039;#ffffff&#039;\" data-popper-arrow><\/span><\/span><\/pre>\n\t<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"reference-element\">Reference element<\/h2>\n\n\n\n<p>Reference element is that triggers the tooltip.<\/p>\n","protected":false},"featured_media":36665,"template":"","docs_category":[21],"class_list":["post-33947","docs","type-docs","status-publish","has-post-thumbnail","hentry","docs_category-shortcodes"],"_links":{"self":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/docs\/33947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/types\/docs"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/media\/36665"}],"wp:attachment":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/media?parent=33947"}],"wp:term":[{"taxonomy":"docs_category","embeddable":true,"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/docs_category?post=33947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}