Template:Alert/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
Created page with "{{Template rating|{{PAGENAME}}|rating=draft}}"
 
Ganaram inukshuk (talk | contribs)
rewrite; emphasize (hopefully) usage as a metatemplate
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template rating|{{PAGENAME}}|rating=draft}}
{{Dochead|header=metatemplate}}{{Template rating|{{PAGENAME}}|rating=ready}}{{clear}}{{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 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>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. 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>).
* <code>label</code>: A custom label, if provided.
 
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.
 
=== Types and examples ===
{{Alert|text=Alert of '''note''' type, used by [[Template: Note]]. |type=note}}
{{Alert|text=Alert of '''tip''' type, used by [[Template: Tip]]. |type=tip}}
{{Alert|text=Alert of '''warning''' type, used by [[Template: Warning]]. |type=warning}}
 
=== See also ===
* [[Template: Mbox]]

Latest revision as of 23:41, 4 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 documentation is for a ready template. This message indicates that a template is ready for use, or has recently been repaired. This message may be removed once this template has been used on several pages or once it is verified to work as intended.

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 the following 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. Unlike mbox, alert uses an emoji rather than an image, which should be passed in using its HTML entity representation (e.g. use &#x1F642; for 🙂).
  • label: A custom label, if provided.

Templates that use this metatemplate (namely {{note}}, {{tip}}, and {{warning}}) should have pre-assigned values for type, icon, and label, leaving only text available to be modified.

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.

See also