Template:Dndbeyond tooltip/doc: Difference between revisions
Created page with "<noinclude>{{documentation subpage}}</noinclude> Creates the content for a tooltip popup similar to the one used by D&D Beyond. This template should not generally be used dire..." |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<noinclude>{{documentation subpage}}</noinclude> | <noinclude>{{documentation subpage}}</noinclude> | ||
Creates the content for a tooltip popup similar to the one used by D&D Beyond. This template should not generally be used directly from an article, instead a template for a specific tooltip should be created, and ''that'' should be used from an article. | Creates the content for a tooltip popup similar to the one used by D&D Beyond. This template should not generally be used directly from an article, instead a template for a specific tooltip should be created, and ''that'' should be used from an article. | ||
The content of the tooltip can be very finicky, and breaks out of its layout easily, ruining the tooltip effect. Make sure you test any new tooltip before calling it complete! If paragraphs are breaking out of the tooltip, you can use <code><nowiki><span class="fake-p">...</span></nowiki></code> to try and fix it. If lists are breaking out of the tooltip, you can use <code><nowiki><span class="fake-ul"><span class="fake-li">...</span></span></nowiki></code> to try and fix it. | |||
A quick way to setup a new template using this tooltip template is to <code>subst</code> a preexisting template into the new file, same, and then edit with the correct data. For example, <code><nowiki>{{subst:warlock}}</nowiki></code> will get the code from {{tl|warlock}} and copy it into your new template (well, all the code which would normally be transcluded when using the warlock template, which in this case is everything except the category). | |||
<templatedata> | |||
{ | |||
"description": "", | |||
"format": "inline", | |||
"params": { | |||
"linktext": { | |||
"label": "link text", | |||
"description": "Text the user must hover over to view the tooltip. This can be wiki markup, but should be kept to inline output for best user experience.", | |||
"type": "string", | |||
"required": true | |||
}, | |||
"title": { | |||
"label": "tooltip title", | |||
"description": "Text displayed at the top of the tooltip window.", | |||
"type": "string", | |||
"required": true | |||
}, | |||
"type": { | |||
"label": "tooltip type", | |||
"description": "Tag on the right side of the tooltip header.", | |||
"type": "string", | |||
"required": true, | |||
"example": "race, feat, class, etc." | |||
}, | |||
"text": { | |||
"label": "tooltip body", | |||
"description": "Rich text body of the tooltip. Formatting likes to break, so test to make sure it works.", | |||
"type": "string", | |||
"required": true | |||
}, | |||
"icon": { | |||
"label": "icon representing the tooltip", | |||
"description": "A wiki markup image to be displayed on the left side of the title. Image will be scaled to 45x45.", | |||
"type": "string", | |||
"required": false, | |||
"default": "(omitted)", | |||
"example": "[[File:aarakocra.jpg]]" | |||
}, | |||
"offsetx": { | |||
"label": "horizontal offset", | |||
"description": "Offset the tooltip from its default position by the given number of pixels.", | |||
"type": "number", | |||
"required": false, | |||
"default": "0" | |||
}, | |||
"offsety": { | |||
"label": "vertical offset", | |||
"description": "Offset the tooltip from its default position by the given number of pixels.", | |||
"type": "number", | |||
"required": false, | |||
"default": "0" | |||
} | |||
} | |||
} | |||
</templatedata> | |||
<includeonly>[[Category:Tooltip templates| ]]</includeonly> | <includeonly>[[Category:Tooltip templates| ]]</includeonly> |
Latest revision as of 07:56, 24 November 2021
This is a documentation subpage for Template:Dndbeyond tooltip. It contains usage information, categories and other content that is not part of the original Template page. |
Creates the content for a tooltip popup similar to the one used by D&D Beyond. This template should not generally be used directly from an article, instead a template for a specific tooltip should be created, and that should be used from an article.
The content of the tooltip can be very finicky, and breaks out of its layout easily, ruining the tooltip effect. Make sure you test any new tooltip before calling it complete! If paragraphs are breaking out of the tooltip, you can use <span class="fake-p">...</span>
to try and fix it. If lists are breaking out of the tooltip, you can use <span class="fake-ul"><span class="fake-li">...</span></span>
to try and fix it.
A quick way to setup a new template using this tooltip template is to subst
a preexisting template into the new file, same, and then edit with the correct data. For example, {{subst:warlock}}
will get the code from {{warlock}} and copy it into your new template (well, all the code which would normally be transcluded when using the warlock template, which in this case is everything except the category).
Parameter | Description | Type | Status | |
---|---|---|---|---|
link text | linktext | Text the user must hover over to view the tooltip. This can be wiki markup, but should be kept to inline output for best user experience. | String | required |
tooltip title | title | Text displayed at the top of the tooltip window. | String | required |
tooltip type | type | Tag on the right side of the tooltip header.
| String | required |
tooltip body | text | Rich text body of the tooltip. Formatting likes to break, so test to make sure it works. | String | required |
icon representing the tooltip | icon | A wiki markup image to be displayed on the left side of the title. Image will be scaled to 45x45.
| String | optional |
horizontal offset | offsetx | Offset the tooltip from its default position by the given number of pixels.
| Number | optional |
vertical offset | offsety | Offset the tooltip from its default position by the given number of pixels.
| Number | optional |