Template:Tt: Difference between revisions

From Tiny Rogues Wiki
(Created page with "<includeonly><{{{span|div}}} data-tippy-content="x" data-tippy-placement="{{{pos|}}}" style="display: inline-block; {{#ifeq:{{{line|}}}|false||margin-bottom: 3px; text-decoration-style: dotted; text-decoration-thickness: 1px; text-decoration-line: underline; text-decoration-color: inherit; text-underline-offset: 5px;}} {{{style|}}}" class="tippy-btn {{{class|}}}"><span class="content"><{{{span|div}}} style="text-align: {{{align|center}}};">{{{2|}}}</{{{span|div}}}></span...")
 
No edit summary
Line 1: Line 1:
<includeonly><{{{span|div}}} data-tippy-content="x" data-tippy-placement="{{{pos|}}}" style="display: inline-block; {{#ifeq:{{{line|}}}|false||margin-bottom: 3px; text-decoration-style: dotted; text-decoration-thickness: 1px; text-decoration-line: underline; text-decoration-color: inherit; text-underline-offset: 5px;}} {{{style|}}}" class="tippy-btn {{{class|}}}"><span class="content"><{{{span|div}}} style="text-align: {{{align|center}}};">{{{2|}}}</{{{span|div}}}></span><{{{span|div}}}>{{{1|}}}</{{{span|div}}}></{{{span|div}}}></includeonly><noinclude>{{Doc}}</noinclude>
<includeonly><span class="tooltip" {{ #ifeq: {{{line|true}}} | false | style="border-bottom: 0;" }}>{{{1}}}<span class="tooltiptext" style="{{#if:{{{text-align|}}}|text-align:{{{text-align|default}}};}}">{{{2}}}</span></span></includeonly><noinclude>== What this is ==
A template to write tooltips!
 
== Usage & Examples ==
<pre><nowiki>{{tt|Normal text|Tooltip text}}</nowiki></pre>
{{tt|Normal text|Tooltip text}}
<br>
<pre><nowiki>{{tt|Normal text without underline|Tooltip text|line=false}}</nowiki></pre>
{{tt|Normal text without underline|Tooltip text|line=false}}
<br>
<pre><nowiki>{{tt|1=Tooltip text with horizontal rule|2=Tooltip<span class="hr"></span>Text}}</nowiki></pre>
{{tt|1=Tooltip text with horizontal rule|2=Tooltip<span class="hr"></span>Text}}
<br>
<pre><nowiki>{{tt|{{tt|Nested tooltip|Bottom text}}|Top text}}</nowiki></pre>
{{tt|{{tt|Nested tooltip|Bottom text}}|Top text}}
<br>
<pre><nowiki>{{tt|left-aligned text|Tooltip text|text-align=left}}</nowiki></pre>
{{tt|left-aligned text|Tooltip text|text-align=left}}
 
== Notes ==
* Do '''not''' use <code><nowiki><hr /></nowiki></code> inside tooltips!
** Use <code><nowiki><span class="hr"></span></nowiki></code> instead (with named parameters; i.e. <code><nowiki>|1=</nowiki></code> and <code><nowiki>|2=</nowiki></code>)
** This is due to mw parser spawning random linebreaks if <code><nowiki><hr /></nowiki></code> is used.
 
[[Category:Code templates]][[Category:Templates]]
 
 
<templatedata>
{
"params": {
"1": {
"label": "Text",
"description": "Text to be shown by normally.",
"type": "string",
"required": true
},
"2": {
"label": "Tooltip Text",
"description": "Text to be shown in the tooltip when hovered.",
"type": "string",
"required": true
},
"line": {
"label": "Show Underline",
"description": "Defaults to true. Set to false to hide the dotted underline.",
"type": "boolean"
},
"text-align": {
"label": "Text Align",
"description": "Overrides text-align style. Possible values: left, center, right, justify.",
"type": "string"
}
},
"description": "A template to write tooltips!",
"paramOrder": [
"1",
"2",
"line",
"text-align"
],
"format": "inline"
}
</templatedata>
</noinclude>

Revision as of 01:51, 23 December 2023

What this is

A template to write tooltips!

Usage & Examples

{{tt|Normal text|Tooltip text}}

Normal textTooltip text

{{tt|Normal text without underline|Tooltip text|line=false}}

Normal text without underlineTooltip text

{{tt|1=Tooltip text with horizontal rule|2=Tooltip<span class="hr"></span>Text}}

Tooltip text with horizontal ruleTooltipText

{{tt|{{tt|Nested tooltip|Bottom text}}|Top text}}

Nested tooltipBottom textTop text

{{tt|left-aligned text|Tooltip text|text-align=left}}

left-aligned textTooltip text

Notes

  • Do not use <hr /> inside tooltips!
    • Use <span class="hr"></span> instead (with named parameters; i.e. |1= and |2=)
    • This is due to mw parser spawning random linebreaks if <hr /> is used.


A template to write tooltips!

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Text1

Text to be shown by normally.

Stringrequired
Tooltip Text2

Text to be shown in the tooltip when hovered.

Stringrequired
Show Underlineline

Defaults to true. Set to false to hide the dotted underline.

Booleanoptional
Text Aligntext-align

Overrides text-align style. Possible values: left, center, right, justify.

Stringoptional