Difference between revisions of "Template:Admonition"

From ThresholdRPG Wiki
(Created page with "<includeonly>{{#switch: {{{type|note}}} | note = {{#vardefine: icon|πŸ“}}{{#vardefine: color|#448aff}}{{#vardefine: title|Note}} | warning = {{#vardefine: icon|⚠️}}{{...")
 
Line 1: Line 1:
βˆ’
<includeonly>{{#switch: {{{type|note}}}
+
<includeonly>{| style="margin: 1.5em 0; padding: 0; border-left: 4px solid {{#switch: {{{type|note}}}
βˆ’
   | note = {{#vardefine: icon|πŸ“}}{{#vardefine: color|#448aff}}{{#vardefine: title|Note}}
+
   | note = #448aff
βˆ’
   | warning = {{#vardefine: icon|⚠️}}{{#vardefine: color|#ff9100}}{{#vardefine: title|Warning}}
+
   | warning = #ff9100
βˆ’
   | tip = {{#vardefine: icon|πŸ’‘}}{{#vardefine: color|#00bfa5}}{{#vardefine: title|Tip}}
+
   | tip = #00bfa5
βˆ’
   | important = {{#vardefine: icon|❗}}{{#vardefine: color|#ff1744}}{{#vardefine: title|Important}}
+
   | important = #ff1744
βˆ’
   | info = {{#vardefine: icon|ℹ️}}{{#vardefine: color|#2196f3}}{{#vardefine: title|Info}}
+
   | info = #2196f3
βˆ’
   | question = {{#vardefine: icon|❓}}{{#vardefine: color|#9c27b0}}{{#vardefine: title|Question}}
+
   | question = #9c27b0
βˆ’
   | caution = {{#vardefine: icon|🚧}}{{#vardefine: color|#ff5722}}{{#vardefine: title|Caution}}
+
   | caution = #ff5722
βˆ’
}}
+
  | #default = #448aff
βˆ’
{| style="margin: 1.5em 0; padding: 0; border-left: 4px solid {{#var: color}}; background-color: #f8f9fa; width: 100%;"
+
}}; background-color: #f8f9fa; width: 100%;"
βˆ’
! style="padding: 8px 12px; background-color: {{#var: color}}15; font-weight: bold;" | {{#var: icon}} {{{title|{{#var: title}}}}}
+
! style="padding: 8px 12px; background-color: {{#switch: {{{type|note}}}
 +
  | note = #448aff15
 +
  | warning = #ff910015
 +
  | tip = #00bfa515
 +
  | important = #ff174415
 +
  | info = #2196f315
 +
  | question = #9c27b015
 +
  | caution = #ff572215
 +
  | #default = #448aff15
 +
}}; font-weight: bold;" | {{#switch: {{{type|note}}}
 +
  | note = πŸ“
 +
  | warning = ⚠️
 +
  | tip = πŸ’‘
 +
  | important = ❗
 +
  | info = ℹ️
 +
  | question = ❓
 +
  | caution = 🚧
 +
  | #default = πŸ“
 +
}} {{{title|{{#switch: {{{type|note}}}
 +
  | note = Note
 +
  | warning = Warning
 +
  | tip = Tip
 +
  | important = Important
 +
  | info = Info
 +
  | question = Question
 +
  | caution = Caution
 +
  | #default = Note
 +
}}}}}
 
|-
 
|-
 
| style="padding: 12px;" | {{{1}}}
 
| style="padding: 12px;" | {{{1}}}
Line 37: Line 64:
  
 
=== Examples ===
 
=== Examples ===
βˆ’
<nowiki>
+
<pre>
βˆ’
{{Admonition|This is a default note.}}
+
<nowiki>{{Admonition|This is a default note.}}</nowiki>
βˆ’
 
+
<nowiki>{{Admonition|type=warning|This is a warning message.}}</nowiki>
βˆ’
{{Admonition|type=warning|This is a warning message.}}
+
<nowiki>{{Admonition|type=tip|title=Pro Tip!|This is a custom-titled tip.}}</nowiki>
βˆ’
 
+
<nowiki>{{Admonition|type=important|This is important information.}}</nowiki>
βˆ’
{{Admonition|type=tip|title=Pro Tip!|This is a custom-titled tip.}}
+
<nowiki>{{Admonition|type=info|This is additional information.}}</nowiki>
βˆ’
 
+
<nowiki>{{Admonition|type=question|Have you considered this?}}</nowiki>
βˆ’
{{Admonition|type=important|This is important information.}}
+
<nowiki>{{Admonition|type=caution|Proceed with caution.}}</nowiki>
βˆ’
 
+
</pre>
βˆ’
{{Admonition|type=info|This is additional information.}}
 
βˆ’
 
 
βˆ’
{{Admonition|type=question|Have you considered this?}}
 
βˆ’
 
 
βˆ’
{{Admonition|type=caution|Proceed with caution.}}
 
βˆ’
</nowiki>
 
  
 
=== Live Examples ===
 
=== Live Examples ===

Revision as of 02:44, 6 February 2025


Usage

This template creates admonition boxes (highlighted message boxes) with different styles based on type.

Syntax

{{Admonition|type=TYPE|text}}

or

{{Admonition|type=TYPE|title=CUSTOM TITLE|text}}

Available Types

  • note (default) - For general information
  • warning - For warning messages
  • tip - For helpful tips
  • important - For crucial information
  • info - For additional information
  • question - For questions or FAQs
  • caution - For careful consideration

Examples

{{Admonition|This is a default note.}}
{{Admonition|type=warning|This is a warning message.}}
{{Admonition|type=tip|title=Pro Tip!|This is a custom-titled tip.}}
{{Admonition|type=important|This is important information.}}
{{Admonition|type=info|This is additional information.}}
{{Admonition|type=question|Have you considered this?}}
{{Admonition|type=caution|Proceed with caution.}}

Live Examples

  1. 448aff; background-color: #f8f9fa; width: 100%;"
style="padding: 8px 12px; background-color:
  1. 448aff15; font-weight: bold;" | πŸ“ Note
This is a default note.


  1. ff9100; background-color: #f8f9fa; width: 100%;"
style="padding: 8px 12px; background-color:
  1. ff910015; font-weight: bold;" | ⚠️ Warning
This is a warning message.


  1. 00bfa5; background-color: #f8f9fa; width: 100%;"
style="padding: 8px 12px; background-color:
  1. 00bfa515; font-weight: bold;" | πŸ’‘ Pro Tip!
This is a custom-titled tip.