Template:IconLink: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
(add nowrap)
(Use template demo)
 
(4 intermediate revisions by 3 users not shown)
Line 9: Line 9:
| gap = {{{gap|}}}
| gap = {{{gap|}}}
| nowrap = {{{nowrap|}}}
| nowrap = {{{nowrap|}}}
| class = {{{class|}}}
}}</includeonly><noinclude>
}}</includeonly><noinclude>
Usage: {{code|<nowiki>{{IconLink | Flourish Icon.png | Flourish }}</nowiki>}}
Displays a link with an icon.


Result: {{IconLink | Flourish Icon.png | Flourish }}
== Examples ==
 
{{Template demo
The link text can be changed with a third parameter:
| style = table
 
| caption 1 = Default
Usage: {{code|<nowiki>{{IconLink | Flourish Icon.png | Flourish | Custom Text }}</nowiki>}}
| <nowiki>{{IconLink | Flourish Icon.png | Flourish }}</nowiki>
 
| caption 2 = Custom link text
Result: {{IconLink | Flourish Icon.png | Flourish | Custom Text }}
| <nowiki>{{IconLink | Flourish Icon.png | Flourish | Custom Text }}</nowiki>
}}


The default size is {{code|x40px}} meaning the icon is scaled until the '''height''' is 40 px.  It's usually important to limit the height since the icons are used inline, and a very high inline image makes for an unpleasant text layout.
The default size is {{code|x40px}} meaning the icon is scaled until the '''height''' is 40 px.  It's usually important to limit the height since the icons are used inline, and a very high inline image makes for an unpleasant text layout.
Line 24: Line 26:
An alternative value for the height can be provided via the {{code|size}} or {{code|h}} parameters, which are synonyms:
An alternative value for the height can be provided via the {{code|size}} or {{code|h}} parameters, which are synonyms:


Usage: {{code|<nowiki>{{IconLink | size = 25 | Flourish Icon.png | Flourish }}</nowiki>}}
{{Template demo
 
| style = table
Result: {{IconLink | size = 25 | Flourish Icon.png | Flourish }}
| <nowiki>{{IconLink | size = 25 | Flourish Icon.png | Flourish }}</nowiki>
 
| <nowiki>{{IconLink | size = 25 | Flourish Icon.png | Flourish | Custom Text }}</nowiki>
Usage: {{code|<nowiki>{{IconLink | size = 25 | Flourish Icon.png | Flourish | Custom Text }}</nowiki>}}
| <nowiki>{{IconLink | Missing Icon 123.png | Flourish | Custom Text | size = 30}}</nowiki>
 
}}
Result: {{IconLink | size = 25 | Flourish Icon.png | Flourish | Custom Text }}
 
Behavior on missing icon:
 
{{IconLink | Missing Icon 123.png | Flourish | Custom Text | size = 30 }}


The width can be set via the {{code|w}} parameter.  This could be useful if several elements are supposed to align vertically for design purposes, such as in the following table shown on our main page as of the writing of this documentation.  This also uses the {{code|block}} and {{code|gap}} parameters.  View the source of this page for usage.
The width can be set via the {{code|w}} parameter.  This could be useful if several elements are supposed to align vertically for design purposes, such as in the following table shown on our main page as of the writing of this documentation.  This also uses the {{code|block}} and {{code|gap}} parameters.  View the source of this page for usage.
Line 64: Line 61:
| The number you add to your rolls based on whether you have [[Proficiency]].
| The number you add to your rolls based on whether you have [[Proficiency]].
|}
|}
[[Category:Icon Templates]]


== Template parameters ==
== Template parameters ==
Line 102: Line 97:
"description": "If specified, will add the nowrap css style to the span.",
"description": "If specified, will add the nowrap css style to the span.",
"type": "boolean"
"type": "boolean"
},
"class": {
"description": "Any classes to add to the img"
}
}
},
},
Line 113: Line 111:
"block",
"block",
"gap",
"gap",
"nowrap"
"nowrap",
"class"
],
],
"description": "Insert a linked icon."
"description": "Insert a linked icon."
}
}
</templatedata></noinclude>
</templatedata>
[[Category:Templates]]
[[Category:Icon templates]]
[[Category:Link templates]]
</noinclude>

Latest revision as of 09:16, 19 January 2025

Displays a link with an icon.

Examples

Example Markup Renders as
Default
{{IconLink | Flourish Icon.png | Flourish }}
Flourish Flourish
Custom link text
{{IconLink | Flourish Icon.png | Flourish | Custom Text }}
Custom Text Custom Text

The default size is x40px meaning the icon is scaled until the height is 40 px. It's usually important to limit the height since the icons are used inline, and a very high inline image makes for an unpleasant text layout.

An alternative value for the height can be provided via the size or h parameters, which are synonyms:

Markup Renders as
{{IconLink | size = 25 | Flourish Icon.png | Flourish }}
Flourish Flourish
{{IconLink | size = 25 | Flourish Icon.png | Flourish | Custom Text }}
Custom Text Custom Text
{{IconLink | Missing Icon 123.png | Flourish | Custom Text | size = 30}}
File:Missing Icon 123.png Custom Text

The width can be set via the w parameter. This could be useful if several elements are supposed to align vertically for design purposes, such as in the following table shown on our main page as of the writing of this documentation. This also uses the block and gap parameters. View the source of this page for usage.

Rolls
Attack Roll Attack Roll The roll you make to determine whether an attack hits an enemy at all.
Damage Roll Damage Roll The roll you make to determine the amount of damage done by a successful attack.
Saving Throw Saving Throw The roll you make to attempt avoiding various threats other than direct attacks.
Ability Check Ability Check The roll you make when attempting anything else that requires a roll to succeed.
Modifiers
Advantage Advantage Roll the die twice, and use the higher result. Disadvantage is the exact opposite.
Ability Score Modifier Ability Score Modifier The number you add to your rolls based on your Ability Scores.
Proficiency Bonus Proficiency Bonus The number you add to your rolls based on whether you have Proficiency.

Template parameters

Insert a linked icon.

Template parameters

ParameterDescriptionTypeStatus
11

The file to display as an icon, without the File: prefix.

Stringrequired
22

Where to link to.

Page namerequired
33

(optional) Replaces the link text with this if specified.

Stringoptional
ww

(optional) Override the width of the image.

Numberoptional
hh

(optional) Override the height of the image.

Numberoptional
sizesize

(optional) Set the size of the image to this by this.

Numberoptional
blockblock

no description

Unknownoptional
gapgap

no description

Unknownoptional
nowrapnowrap

If specified, will add the nowrap css style to the span.

Booleanoptional
classclass

Any classes to add to the img

Unknownoptional