More actions
m Add the actual syntax. |
Re-phrase text. Add TemplateData. |
||
| Line 1: | Line 1: | ||
; Description | ; Description | ||
: | : Produces a centered, colored box, which is used to present an example on a page. | ||
; Dependencies | ; Dependencies | ||
| Line 9: | Line 9: | ||
: {{T|Example|content|3= width= width}} | : {{T|Example|content|3= width= width}} | ||
:; Parameters | :; Parameters | ||
::; content : The | ::; content : The example text inside the box. The box has "<code>An example!</code>" as the default text. If the text includes an equals sign (<code>=</code>), the text needs to be explicitly declared as a numbered parameter (i.e. put <code>1=</code> before the text), otherwise the template will display the default text. | ||
::; width : Sets the width of the box. | ::; width : Sets the width of the box. It's recommended to set this as a percentage (of the paragraph width), so <code>50%</code> will produce a text box half as wide as the surrounding paragraph. The default width is set at 95%. When width is set to less than <code>100%</code>, the box will be centered. | ||
; Examples | ; Examples | ||
| Line 28: | Line 28: | ||
* {{T|Note box}} and {{T|Important note box}} , designed for general notes and warnings on pages. | * {{T|Note box}} and {{T|Important note box}} , designed for general notes and warnings on pages. | ||
* {{T|Color box}} , the general template for creating colored boxes with text in them. | * {{T|Color box}} , the general template for creating colored boxes with text in them. | ||
; Template data | |||
: This is the [[mediawikiwiki:Help:TemplateData|TemplateData]] documentation for this template used by [[mediawikiwiki:VisualEditor|VisualEditor]] and other tools. | |||
:: <templatedata> | |||
{ | |||
"params": { | |||
"1": { | |||
"label": "Content", | |||
"description": "The content of the example box. f the text includes an equals sign (=), the text needs to be explicitly declared as a numbered parameter (i.e. put 1= before the text), otherwise the template will display the default text.", | |||
"type": "content", | |||
"default": "An example!", | |||
"required": true | |||
}, | |||
"width": { | |||
"description": "Set the width of the box. Preferably in %", | |||
"type": "string", | |||
"default": "95%" | |||
} | |||
}, | |||
"description": "Box to present examples in articles. When the (optional) width is set to less then 100% the box will be centered.", | |||
"format": "{{_\n| _= _\n}}" | |||
}</templatedata> | |||
<includeonly>[[Category:Formatting templates]]</includeonly> | <includeonly>[[Category:Formatting templates]]</includeonly> | ||
<noinclude>[[Category:Template documentation]]</noinclude> | <noinclude>[[Category:Template documentation]]</noinclude> | ||
Revision as of 10:46, 26 June 2025
- Description
- Produces a centered, colored box, which is used to present an example on a page.
- Dependencies
-
- Uses
- {{Color box}}
- Syntax
- {{Example|<content>|<width= width>}}
- Parameters
-
- content
- The example text inside the box. The box has "
An example!" as the default text. If the text includes an equals sign (=), the text needs to be explicitly declared as a numbered parameter (i.e. put1=before the text), otherwise the template will display the default text. - width
- Sets the width of the box. It's recommended to set this as a percentage (of the paragraph width), so
50%will produce a text box half as wide as the surrounding paragraph. The default width is set at 95%. When width is set to less than100%, the box will be centered.
- Examples
| {{Example|An example to ''illustrate'' my article with a link to the [[Venture]].}} |
gives ...
| {{Example|How not to put the formula 2+2=4 into an example.}} |
gives ...
| {{Example|1= How to put the formula 2+2=4 into an example.}} |
gives ...
- See also
- {{Note box}} and {{Important note box}} , designed for general notes and warnings on pages.
- {{Color box}} , the general template for creating colored boxes with text in them.
- Template data
- This is the TemplateData documentation for this template used by VisualEditor and other tools.
Box to present examples in articles. When the (optional) width is set to less then 100% the box will be centered.
Template parameters
This template has custom formatting.
Parameter Description Type Status Content 1The content of the example box. f the text includes an equals sign (=), the text needs to be explicitly declared as a numbered parameter (i.e. put 1= before the text), otherwise the template will display the default text.
- Default
- An example!
Content required width widthSet the width of the box. Preferably in %
- Default
- 95%
String optional