Difference between revisions of "Template:Admonition"

From ThresholdRPG Wiki
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<includeonly>{| style="margin: 1.5em 0; padding: 0; border-left: 4px solid {{#switch: {{{type|note}}}
+
<includeonly>
  | note = #448aff
+
<div style="border-left: 4px solid {{#switch: {{{type|note}}}|note=#448aff|warning=#ff9100|tip=#00bfa5|important=#ff1744|stop=#ff0000|#default=#448aff}}; background: #444444; margin: 1em 0; border-radius: 3px; width: {{{width|100%}}};">
  | warning = #ff9100
+
<div style="background: {{#switch: {{{type|note}}}|note=#448aff33|warning=#ff910033|tip=#00bfa533|important=#ff174433|stop=#ff000033|#default=#448aff33}}; padding: 8px 12px; font-weight: bold; color: #ffffff;">{{#switch: {{{type|note}}}|note=📝|warning=⚠️|tip=💡|important=❗|stop=🛑|#default=📝}} {{{title|{{#switch: {{{type|note}}}|note=Note|warning=Warning|tip=Tip|important=Important|stop=STOP|#default=Note}}}}}
  | tip = #00bfa5
+
</div>
  | important = #ff1744
+
<div style="padding: 12px; color: #ffffff;">{{{1}}}</div>
  | info = #2196f3
+
</div>
  | question = #9c27b0
 
  | caution = #ff5722
 
  | #default = #448aff
 
}}; background-color: #f8f9fa; width: 100%;"
 
! 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}}}
 
|}
 
 
</includeonly>
 
</includeonly>
 
<noinclude>
 
<noinclude>
 
== Usage ==
 
== Usage ==
This template creates admonition boxes (highlighted message boxes) with different styles based on type.
+
Create admonition boxes with different styles.
  
=== Syntax ===
+
=== Basic Usage ===
<pre>
+
<nowiki>
{{Admonition|type=TYPE|text}}
+
{{Admonition|Your message here}}
</pre>
+
</nowiki>
or
 
<pre>
 
{{Admonition|type=TYPE|title=CUSTOM TITLE|text}}
 
</pre>
 
  
=== Available Types ===
+
=== With Type ===
 +
<nowiki>
 +
{{Admonition|type=warning|Your warning message}}
 +
</nowiki>
 +
 
 +
=== With Custom Title ===
 +
<nowiki>
 +
{{Admonition|type=tip|title=Pro Tip!|Your tip message}}
 +
</nowiki>
 +
 
 +
=== With Custom Width ===
 +
<nowiki>
 +
{{Admonition|width=50%|Your message here}}
 +
{{Admonition|type=warning|width=75%|Your warning message}}
 +
</nowiki>
 +
 
 +
=== Types Available ===
 
* note (default) - For general information
 
* note (default) - For general information
* warning - For warning messages
+
* warning - For cautionary notes
 
* tip - For helpful tips
 
* tip - For helpful tips
 
* important - For crucial information
 
* important - For crucial information
* info - For additional information
+
* stop - For breaking changes or critical warnings
* question - For questions or FAQs
 
* caution - For careful consideration
 
  
=== Examples ===
+
=== Parameters ===
<pre>
+
* type - The type of admonition (optional, defaults to "note")
<nowiki>{{Admonition|This is a default note.}}</nowiki>
+
* title - Custom title (optional, defaults based on type)
<nowiki>{{Admonition|type=warning|This is a warning message.}}</nowiki>
+
* width - Custom width (optional, defaults to "100%")
<nowiki>{{Admonition|type=tip|title=Pro Tip!|This is a custom-titled tip.}}</nowiki>
+
* message - The main content (required)
<nowiki>{{Admonition|type=important|This is important information.}}</nowiki>
 
<nowiki>{{Admonition|type=info|This is additional information.}}</nowiki>
 
<nowiki>{{Admonition|type=question|Have you considered this?}}</nowiki>
 
<nowiki>{{Admonition|type=caution|Proceed with caution.}}</nowiki>
 
</pre>
 
  
 
=== Live Examples ===
 
=== Live Examples ===
{{Admonition|This is a default note.}}
+
{{Admonition|This is a default note at full width.}}
  
{{Admonition|type=warning|This is a warning message.}}
+
{{Admonition|width=50%|This is a note at 50% width.}}
 +
 
 +
{{Admonition|type=warning|width=75%|This is a warning message at 75% width.}}
  
 
{{Admonition|type=tip|title=Pro Tip!|This is a custom-titled tip.}}
 
{{Admonition|type=tip|title=Pro Tip!|This is a custom-titled tip.}}
 +
 +
{{Admonition|type=stop|width=60%|This feature is being removed in the next version. Do not use it for new development.}}
 
</noinclude>
 
</noinclude>

Latest revision as of 18:24, 6 February 2025


Usage

Create admonition boxes with different styles.

Basic Usage

{{Admonition|Your message here}}

With Type

{{Admonition|type=warning|Your warning message}}

With Custom Title

{{Admonition|type=tip|title=Pro Tip!|Your tip message}}

With Custom Width

{{Admonition|width=50%|Your message here}} {{Admonition|type=warning|width=75%|Your warning message}}

Types Available

  • note (default) - For general information
  • warning - For cautionary notes
  • tip - For helpful tips
  • important - For crucial information
  • stop - For breaking changes or critical warnings

Parameters

  • type - The type of admonition (optional, defaults to "note")
  • title - Custom title (optional, defaults based on type)
  • width - Custom width (optional, defaults to "100%")
  • message - The main content (required)

Live Examples

📝 Note
This is a default note at full width.



📝 Note
This is a note at 50% width.



⚠️ Warning
This is a warning message at 75% width.



💡 Pro Tip!
This is a custom-titled tip.



🛑 STOP
This feature is being removed in the next version. Do not use it for new development.