Template:Alert/doc: Difference between revisions

ArrowHead294 (talk | contribs)
m Update documentation to use label parameter.
Ganaram inukshuk (talk | contribs)
rewrite; emphasize (hopefully) usage as a metatemplate
 
(One intermediate revision by one other user not shown)
Line 4: Line 4:


=== Usage ===
=== Usage ===
The template accepts three parameters:
The template accepts the following parameters:
* <code>type</code>: Defines the color of the left border; the type should be chosen according to context, not for aesthetic reasons. Types are described in the next section.
* <code>type</code>: Defines the color of the left border; the type should be chosen according to context, not for aesthetic reasons. Types are described in the next section.
* <code>text</code>: Message to be displayed in the box.
* <code>text</code>: Message to be displayed in the box.
* <code>icon</code>: Icon to be displayed in the box, if provided. Icons appear on the left side of the message box.
* <code>icon</code>: Icon to be displayed in the box, if provided. Icons appear on the left side of the message box. Unlike mbox, alert uses an {{w|emoji}} rather than an image, which should be passed in using its {{w|HTML entity}} representation (e.g. use <code>&amp;#x1F642;</code> for &#x1F642;</code>).
:: The <code>icon</code> parameter is for images. If an {{w|emoji}} is used as an icon, <code>label</code> should be used instead.
* <code>label</code>: A custom label, if provided.
* <code>icon size</code>: Size of the icon displayed. Default is 20px.
 
* <code>label</code>: Displays a label such as "warning", "note", or "tip". This is also useful if an emoji is used as the icon instead of an image. Use as follows:
Templates that use this metatemplate (namely <code><nowiki>{{note}}</nowiki></code>, <code><nowiki>{{tip}}</nowiki></code>, and <code><nowiki>{{warning}}</nowiki></code>) should have pre-assigned values for <code>type</code>, <code>icon</code>, and <code>label</code>, leaving only <code>text</code> available to be modified.
:: <syntaxhighlight lang="wikitext">
| label = <span class{{=}}"alert-icon">&#xHHHH;</span>'''Text:'''
| text = {{{1|}}}
</syntaxhighlight>
:: where <code>&amp;#xHHHH;</code> represents the hexadecimal {{w|HTML entity}} representation of the emoji in mind (e.g. use <code>&amp;#x1F642;</code> for &#x1F642;</code>).


=== Types and examples ===
=== Types and examples ===