Help:Adding tooltips

From semantic-mediawiki.org
Help:Adding tooltipsAdding tooltips/zh-hans
Adding tooltips
Adding an icon with a tooltip
Further Information
Provided by: Semantic MediaWiki
Minimum version: 1.4.0
Maximum version: still supported
Function: yes
Tag: no
Name: #info
Table of Contents

The #info parser function allows to add tooltips containing additional information or warnings.

It was introduced with Semantic MediaWiki 1.4.0Released on 21 November 2008 and compatible with MW 1.13.x - 1.16.x.. Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. brought a new set of icons with changed iconography1 and Semantic MediaWiki 3.2.0Released on 7 September 2020 and compatible with MW 1.31.0 - 1.35.x. two more parameters ("max-width" and "theme")2.

Syntax[edit]

{{#info: <text> |<icon> |max-width=<width> |theme=<theme> }}

Parameters[edit]

Text[edit]

The first parameter displays the text in the #info bubble and should only contain inline HTML elements. There is limited support for wikitext formatting such as bold, italics and internal links. No paragraphs, tables, lists or any other block elements are allowed. One should also avoid using empty lines (because empty line will terminate one paragraph and start another one) and equal signs (see the tips section). Refraining from those guidelines could lead to incorrect HTML code and rendering (e. g. part of text after empty line could be rendered in the page, not in the bubble).

Icon[edit]

In case a second parameter is passed onto the #info parser function, it will influence the display of the icon. If an incorrect parameter is used then the parameter will be silently ignored, and the default info icon will be displayed instead. Since Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. the icon set was changed to use flat icons. Also the iconography changed as described in the following table:1

Allowed values are:

Icon Description (SMW ≥ 3.0.0) Description (SMW < 3.0.0) Example
info A blue icon with exclamation mark (default) A blue icon with question mark (default) test
note A blue icon with question mark. A orange icon with exclamation mark. test
warning A orange icon with exclamation mark. A yellow icon with exclamation mark. test
error A red icon with hyphen. A yellow icon with exclamation mark. test

max-width[edit]

The "max-width" parameter allows to define a maximum width for the tooltip. Thus the tooltip may be wider than the default to display more information at once. This parameter takes positive integers as values. It was introduced with Semantic MediaWiki 3.2.0Released on 7 September 2020 and compatible with MW 1.31.0 - 1.35.x..

theme[edit]

The "theme" parameter allows to define a different theme for the tooltip. Thus the tooltip may be adapted in appearance in comparison to the default display. It was introduced with Semantic MediaWiki 3.2.0Released on 7 September 2020 and compatible with MW 1.31.0 - 1.35.x..

Allowed values are:

  • square-border
  • square-border-light

Examples[edit]

Code Result Comment
Some inline text {{#info: Text to be shown in a bubble. }} Some inline text Text to be shown in a bubble. Click on the icon to see the bubble.
Telephone number {{#info: Please enter it in the format e.g. +49-30-45084940 |note }} Telephone number Please enter it in the format e.g. +49-30-45084940 Available since Semantic MediaWiki 1.9.0Released on 3 January 2014 and compatible with MW 1.19.0 - 1.22.x.
https://www.semantic-mediawiki.org/ {{#info: Please always use https whenever possible. |warning }} https://www.semantic-mediawiki.org/ Please always use https whenever possible. Available since Semantic MediaWiki 1.7.0Released on 1 January 2012 and compatible with MW 1.16.x - 1.19.x.
2011-02-29 {{#info: Incorrect date. |error }} 2011-02-29 Incorrect date. Available since Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x.
A lot of text to be shown in a note {{#info: A lot of text to be shown in a note.... |max-width=600 |note }} Increase bubble width A lot of text to be shown in a note. Some More text and still some more text. Some More text and still some more text. Some More text and still some more text. Some More text and still some more text.</br></br>A lot of text to be shown in a note. Some More text and still some more text. Some More text and still some more text. Some More text and still some more text. Some More text and still some more text. Available since Semantic MediaWiki 3.2.0Released on 7 September 2020 and compatible with MW 1.31.0 - 1.35.x.
An note using a different theme. {{#info: An note using a different theme. |theme=square-border-light |note }} An note using a different theme. An note using a different theme. Available since Semantic MediaWiki 3.2.0Released on 7 September 2020 and compatible with MW 1.31.0 - 1.35.x.

See also:

Related tips[edit]



References

  1. a b  Semantic MediaWiki: GitHub issue gh:smw:2691
  2. ^  Semantic MediaWiki: GitHub issue gh:smw:4586