Template:Alert/doc: Difference between revisions
Jump to navigation
Jump to search
ArrowHead294 (talk | contribs) m Add documentation on emoji icons. |
ArrowHead294 (talk | contribs) m Update documentation to use label parameter. |
||
| Line 8: | Line 8: | ||
* <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. | ||
:: The <code>icon</code> parameter is for images. If an {{w|emoji}} is used as an icon, | :: The <code>icon</code> parameter is for images. If an {{w|emoji}} is used as an icon, <code>label</code> should be used instead. | ||
:: <syntaxhighlight lang="wikitext">| | * <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: | |||
:: <syntaxhighlight lang="wikitext"> | |||
| label = <span class{{=}}"alert-icon">&#xHHHH;</span>'''Text:''' | |||
| text = {{{1|}}} | |||
</syntaxhighlight> | |||
:: where <code>&#xHHHH;</code> represents the hexadecimal {{w|HTML entity}} representation of the emoji in mind (e.g. use <code>&#x1F642;</code> for 🙂</code>). | :: where <code>&#xHHHH;</code> represents the hexadecimal {{w|HTML entity}} representation of the emoji in mind (e.g. use <code>&#x1F642;</code> for 🙂</code>). | ||
=== Types and examples === | === Types and examples === | ||
Revision as of 20:33, 3 February 2026
- This template is a metatemplate. It is used to build other templates and should not be used standalone, except for testing or simple usage.
| This template uses TemplateStyles: |
The Alert template is a metatemplate which is used to create alerts, also known as callouts or admonitions, to call attention to critical information. It is intended to be used in other templates for messages which are expected to be used on multiple pages.
Usage
The template accepts three parameters:
type: 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.text: Message to be displayed in the box.icon: Icon to be displayed in the box, if provided. Icons appear on the left side of the message box.
- The
iconparameter is for images. If an emoji is used as an icon,labelshould be used instead.
- The
icon size: Size of the icon displayed. Default is 20px.label: 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:
| label = <span class{{=}}"alert-icon">&#xHHHH;</span>'''Text:''' | text = {{{1|}}}
- where
&#xHHHH;represents the hexadecimal HTML entity representation of the emoji in mind (e.g. use🙂for 🙂).
Types and examples
| Alert of note type, used by Template: Note. |
| Alert of tip type, used by Template: Tip. |
| Alert of warning type, used by Template: Warning. |