Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Mbox/doc: Difference between revisions

Template page
no need to hide these boxes on the /doc subpage
 
(80 intermediate revisions by 26 users not shown)
Line 1: Line 1:
This is the '''Gallery and Image message box''' template. It could be used to construct image and gallery message box templates.
<div style="float:right>{{Redirects| TS/cmbox| TS/gibox| TS/ombox| Ambox|Gibox|mbox|Ombox}}
{{Lua|Module:Message box}}{{Uses TemplateStyles|Template:Mbox/styles.css}}</div>
{{used in system}}
{{TemplateBox
|1        = text
|1label-en = text
|1label-ru = текст
|1d-en    = The text to be displayed.
|1d-ru    = Отображаемый текст.
|1type    = content
|1def      = <!-- default value for the parameter -->
|1stat    = required


<big>Please note that at this moment there is no consensus on the use of these. Things ''may'' change. See [[Commons:Template standardization]] for more info. Do not use in a production environment just yet.</big>
|2        = type
|2label-en = type
|2label-ru = тип
|2d-en    = Changes the color depending on the message needed. Each has its own preset image, see [[#{{int:Apisandbox-examples}}]]
  |2d-td-en = Changes the color depending on the message needed. Each has its own preset image, see the template documentation.
|2d-ru    = Меняет цвет в зависимости от нужного сообщения. Каждое сообщение имеет своё предустановленное изображение, посмотрите [[#{{int:Apisandbox-examples}}]]
  |2d-td-ru = Меняет цвет в зависимости от нужного сообщения. Каждое сообщение имеет своё предустановленное изображение, посмотрите документацию шаблона.
|2type    = line
|2def      = notice
|2stat    = optional


==Parameters==
|3        = image
*text - The text to be displayed
|3label-en = left image
*type - Changes the color depending on the message needed. Each has its own preset image
|3label-ru = изображение слева
*image - Override the image
|3d-en    = Override the image (“none” for no image). Use format: <nowiki>[[File:Commons-emblem-urgent.svg|class=noviewer|48px]]</nowiki>. The default depends on the type.
*imageright - Show an image on the right side
|3d-ru    = Изменяет изображение ("none" чтобы не было изображения). Используйте формат: <code><nowiki>[[File:Commons-emblem-urgent.svg|class=noviewer|48px]]</nowiki></code>. Значение по умолчанию зависит от типа.
*textalign - Override default centering of text with left or right.
|3type    = content
*Style - Override in custom style overrides for the template using CSS.
|3def      =
|3stat    = optional


==Examples==
|4        = imageright
{{gibox
|4label-en = right image
|text=warning - for speedy deletion and other serious notices
|4label-ru = изображение справа
|type=warning
|4d-en    = Show an image on the right side, similar to the left one (but empty by default).
|4d-ru    = Показывает изображение с правой стороны, как и с левой (но является пустым по умолчанию).
|4type    = content
|4def      = <!-- default value for the parameter -->
|4stat    = optional-
 
|5        = textstyle
|5label-en = text style
|5label-ru = стиль текста
|5d-en    = Override/augment default style of text cell (e.g. alignment — text-align:left; / text-align:right; / text-align:center;).
|5d-ru    = Изменяет/расширяет стиль текстового поля по умолчанию (например, выравнивание — <code>text-align:left;</code> / <code>text-align:right;</code> / <code>text-align:center;</code>)
|5type    = line
|5stat    = optional-
 
|6        = style
|6label-en = box style
|6label-ru = стиль бокса
|6d-en    = Override/augment default style of the whole message box.
|6d-ru    = Изменяет/расширяет стиль по умолчанию всего бокса с уведомлением.
|6type    = line
|6stat    = optional-
|7        = class
|7label-en = box class
|7label-ru = класс бокса
|7d-en    = Augment default CSS classes of the whole message box. Particularly useful if your template uses TemplateStyles.
|7d-ru    = Расширяет CSS-классы по умолчанию всего бокса с уведомлением. Особенно полезно, если ваш шаблон использует TemplateStyles.
|7type    = line
|7stat    = optional-
 
|8        = lang
|8label-en = language
|8label-ru = язык
|8d-en    = Set the language of the text – it's important for right-to-left languages: their image is on the right and imageright is on the left. It helps assistive software (e.g. screen readers) even in left-to-right languages.
|8d-ru    = Устанавливает язык текста — это важно для языков с написанием справа налево: изображение у них располагается справа, а imageright — слева. Это помогает вспомогательному программному обеспечению (например, программам чтения с экрана) даже при использовании языков с написанием слева направо.
|8type    = line
|8stat    = optional-
 
|9        = width
|9label-en = box width
|9label-ru = ширина бокса
|9d-en    = Set the width of the box (avoid using it, 80% for example is too large as it leaves only 10% of the page content width for the left/right margins where there may be floating elements generally large of about 250px: if this occurs the Mbox will be displayed at a much lower position on the page, as if there was a "clear:both", so Mbox may not be immediately visible without scrolling down the page with a huge blank space in the middle and all the rest of the page after the Mbox will be also invisible without scrolling). Instead, use the "margin" parameter to set horizontal margins.
To avoid the centering, and/or the thick left border, modify e.g. “style=margin-left:0;border-left:2px solid #F4C430”
|9d-ru    = Устанавливает ширину бокса (избегайте его использования, например, 80% — это слишком много, так как остаётся только по 10 % от ширины содержимого страницы для левого и правого полей, где могут быть плавающие элементы размером около 250px: в этом случае Mbox будет отображаться гораздо ниже на странице, как если бы было использовано <code>"clear:both"</code>, поэтому Mbox может быть не сразу видим без долгой прокрутки страницы с огромным пустым пространством посередине, как и вся остальная часть страницы после Mbox будет также невидима без прокрутки). Вместо этого используйте параметр "margin" для установки горизонтальных полей.
Чтобы избежать выравнивания по центру и/или толстой левой границы, внесите изменение, например, <code>"style=margin-left:0;border-left:2px solid #F4C430"</code>.
|9type    = line
|9def      = auto
|9stat    = optional-
 
|10        = margin
|10label-en = horizontal margin
|10label-ru = поля по краям<!--Oh, I'm hoping that I'm not wrong with this translation!-->
|10d-en    = Set the horizontal margin of the box (by default it is "auto" if a legacy width is specified, otherwise it is "10%").
|10d-ru    = Установливает горизонтальное поле бокса (по умолчанию — "auto", если указана наследуемая ширина, в противном случае — "10%").
|10type    = line
|10def      = 10%
|10stat    = optional-
 
|name = Mbox
|desc = This is used to create message boxes.
|namespace = all
|usergroup = all
|placement =
|usage-notes =
|type =
|example =
|example-value =
|i18n-method = TNT
|i18n-desc =
|i18n-mediawiki-msg =
|i18n-subpage =
|i18n-data-file = Message box
|seealso =
* {{t|NoteBox}}
|setscats =
|print = multi
|shorthand =
|relieson =
|mustbesubst =
|useTemplateData = 1
}}
 
== Note ==
{{LangSwitch
| en = The icon displayed in the message box is clickable and drives to Commons (to see its attributions), but only when the message box is displayed in a "Template:" page (including their talk pages). When the template is displayed in a page belonging to all other namespaces, no link is generated, only the icon is visible directly.
| ru = Иконка, отображаемая в окне сообщения, является кликабельной и ведёт на Викисклад (для просмотра её атрибуций), но только когда окно сообщения отображается на странице «Шаблон:» (включая его страницу обсуждения). Когда шаблон отображается на странице, принадлежащей всем остальным пространствам имен, ссылка не генерируется, отображается только иконка.
}}
 
== {{int:Apisandbox-examples}} ==
=== All possible values for parameter "type" ===
{{mbox
|text=<code><nowiki>type=</nowiki></code>''(empty)'' → default ''(synonym to'' <code>notice</code>'')''
}}
 
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''notice'''</span></code> → for informative messages only
|type=notice
}}
 
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''message'''</span></code> → for informative messages only
|type=message
}}
 
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''query'''</span></code> → for minor issues
|type=query
}}
 
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''style'''</span></code> → for cleanup ''(synonym to'' <code>query</code>, ''only different icon)''
|type=style
}}
 
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''issue'''</span></code> → for larger issues
|type=issue
}}
 
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''content'''</span></code> → for content issues ''(synonym to'' <code>issue</code>'')''
|type=content
}}
}}
{{gibox
 
|text=serious - for deletion notices
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''serious'''</span></code> → for serious notices
|type=serious
|type=serious
}}
}}
{{gibox
{{mbox
|text=issue - for larger issues
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''delete'''</span></code> → for deletion notices ''(synonym to'' <code>serious</code>'')''
|type=issue
|type=delete
}}
 
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''stop'''</span></code> → for stop and other caution notices, such as frequent issues ''(synonym to'' <code>serious</code>, ''only different icon)''
|type=stop
}}
 
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''speedy'''</span></code> → for speedy deletion notices
|type=speedy
}}
 
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''warning'''</span></code> → for urgent notices ''(synonym to'' <code>speedy</code>'')''
|type=warning
}}
}}
{{gibox
 
|text=query - for minor issues
{{mbox
|type=query
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''move'''</span></code> → for move requests
|type=move
}}
}}
{{gibox
 
|text=notice
{{mbox
|type=notice
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''protection'''</span></code> → for protection notices ''(synonym to'' <code>message</code>, ''only different icon)''
|type=protection
}}
}}
{{gibox
 
|text=license - for licenses (please note, the icon is an example, templates will still use their current icons where applicable)
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''license'''</span></code> → for licenses
|type=license
|type=license
}}
}}
{{gibox
 
|text=legal - for legal disclaimers such as {{tl|Trademark}}
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''legal'''</span></code> → for legal disclaimers such as {{tl|Trademark}}
|type=legal
|type=legal
}}
}}
{{gibox
 
|text=protection - for protection notices
{{mbox
|type=protection
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''honor'''</span></code> → for honors such as featured image
}}
{{gibox
|text=honor - for honors such as featured image
|type=honor
|type=honor
}}
}}
{{gibox
 
|text=growth - for other "good" notices
{{mbox
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''growth'''</span></code> → for other "good" notices
|type=growth
|type=growth
}}
}}
{{gibox
 
|text=move - for move requests
{{mbox
|type=move
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''shit'''</span></code> → for fun ... or for maintenance affairs :) <!-- In loving memory of user:sarang [[Special:Diff/353375588]] Let's keep his humor alive! -->
|type=shit
}}
 
=== Examples with more parameters ===
{{mbox
|text=<code>type = </code>''(empty)'' and <code>'''<nowiki>style = </nowiki>'''background:#DFF</code>
|type=
|style=background:#DFF
}}
 
{{Mbox
|text = <code>type = query</code> and <code>'''<nowiki>image = </nowiki>'''<nowiki>[[</nowiki>[[:File:Warning.svg]]<nowiki>|alt=Exclamation mark|30px|class=noviewer]]</nowiki></code>
|type = query
|image = [[File:Warning.svg|alt=Exclamation mark|30px|class=noviewer]]
}}
{{Mbox
|text = <code>type = query</code> and <code>'''<nowiki>image = </nowiki>'''<nowiki>[[File:OOjs UI icon alert-yellow.svg|alt=Exclamation mark|40px|class=noviewer]]</nowiki></code>
|type = query
|image = [[File:OOjs UI icon alert-yellow.svg|alt=Exclamation mark|40px|class=noviewer]]
}}
{{Mbox
|text = &#8198;<code>type = query</code> and <code>'''<nowiki>image = </nowiki>'''<nowiki>[[</nowiki>[[:File:Lol exclam.png]]<nowiki>|alt=Exclamation mark|38px|class=noviewer]]</nowiki></code>
|type = query
|image = [[File:Lol exclam.png|alt=Exclamation mark|38px|class=noviewer]]
}}
 
{{Mbox
|text = <code>type = issue</code>, <code>'''<nowiki>image = </nowiki>'''<nowiki>[[File:Commons-emblem-hand-orange.svg|alt=Stop hand|45px|class=noviewer]]</nowiki></code> and <code>'''<nowiki>style = </nowiki>'''background:#f7f7f7;</code>
|type = issue
|style = background:#f7f7f7;
|image = [[File:Commons-emblem-hand-orange.svg|alt=Stop hand|45px|class=noviewer]]
}}
}}
<br>
 
{{gibox
{{Mbox
|text=message - emulates {{tl|notice}}
|text=<code>type = message</code>, <code>'''<nowiki>image = </nowiki>'''<nowiki>[[File:Pictogram voting info.svg|20px|class=noviewer]]</nowiki></code> and <code>'''<nowiki>margin =</nowiki> '''0em</code>
|type=message
|type=message
|image=[[File:Pictogram voting info.svg|20px]]
|margin=0em
|}}
{{Mbox
|text=<code>type = growth</code>, <code>'''<nowiki>image = </nowiki>'''none</code> and <code>'''<nowiki>style = </nowiki>'''margin: 10px 0 10px 0</code> <small>(top right bottom left)</small>
|type=growth
|image=none
|style=margin:10px 0 10px 0
|}}
<includeonly>
{{#ifeq:{{SUBPAGENAME}}|sandbox||
[[Category:Style formatting templates]]
[[Category:Message box templates]]
}}
}}
</includeonly>

Latest revision as of 19:11, 30 July 2026

This is used to create message boxes.

Usage

{{Mbox
 |text =
 |type =
 |image =
}}

Template parameters

ParameterDescriptionDefaultStatus
texttextThe text to be displayed.emptyrequired
typetypeChanges the color depending on the message needed. Each has its own preset image, see #Examplesnoticeoptional
imageleft imageOverride the image (“none” for no image). Use format: [[File:Commons-emblem-urgent.svg|class=noviewer|48px]]. The default depends on the type.emptyoptional
imagerightright imageShow an image on the right side, similar to the left one (but empty by default).emptyoptional
textstyletext styleOverride/augment default style of text cell (e.g. alignment — text-align:left; / text-align:right; / text-align:center;).emptyoptional
stylebox styleOverride/augment default style of the whole message box.emptyoptional
classbox classAugment default CSS classes of the whole message box. Particularly useful if your template uses TemplateStyles.emptyoptional
langlanguageSet the language of the text – it's important for right-to-left languages: their image is on the right and imageright is on the left. It helps assistive software (e.g. screen readers) even in left-to-right languages.emptyoptional
widthbox widthSet the width of the box (avoid using it, 80% for example is too large as it leaves only 10% of the page content width for the left/right margins where there may be floating elements generally large of about 250px: if this occurs the Mbox will be displayed at a much lower position on the page, as if there was a "clear:both", so Mbox may not be immediately visible without scrolling down the page with a huge blank space in the middle and all the rest of the page after the Mbox will be also invisible without scrolling). Instead, use the "margin" parameter to set horizontal margins. To avoid the centering, and/or the thick left border, modify e.g. “style=margin-left:0;border-left:2px solid #F4C430”autooptional
marginhorizontal marginSet the horizontal margin of the box (by default it is "auto" if a legacy width is specified, otherwise it is "10%").10%optional
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

This is used to create message boxes.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
box classclass

Augment default CSS classes of the whole message box. Particularly useful if your template uses TemplateStyles.

Lineoptional
left imageimage

Override the image (“none” for no image). Use format: [[File:Commons-emblem-urgent.svg|class=noviewer|48px]]. The default depends on the type.

Contentoptional
right imageimageright

Show an image on the right side, similar to the left one (but empty by default).

Contentoptional
languagelang

Set the language of the text – it's important for right-to-left languages: their image is on the right and imageright is on the left. It helps assistive software (e.g. screen readers) even in left-to-right languages.

Lineoptional
horizontal marginmargin

Set the horizontal margin of the box (by default it is "auto" if a legacy width is specified, otherwise it is "10%").

Default
10%
Lineoptional
box stylestyle

Override/augment default style of the whole message box.

Lineoptional
texttext

The text to be displayed.

Contentrequired
text styletextstyle

Override/augment default style of text cell (e.g. alignment — text-align:left; / text-align:right; / text-align:center;).

Lineoptional
typetype

Changes the color depending on the message needed. Each has its own preset image, see the template documentation.

Default
notice
Lineoptional
box widthwidth

Set the width of the box (avoid using it, 80% for example is too large as it leaves only 10% of the page content width for the left/right margins where there may be floating elements generally large of about 250px: if this occurs the Mbox will be displayed at a much lower position on the page, as if there was a "clear:both", so Mbox may not be immediately visible without scrolling down the page with a huge blank space in the middle and all the rest of the page after the Mbox will be also invisible without scrolling). Instead, use the "margin" parameter to set horizontal margins. To avoid the centering, and/or the thick left border, modify e.g. “style=margin-left:0;border-left:2px solid #F4C430”

Default
auto
Lineoptional

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

See also

Localization

This template is localized using Module:TNT. These translations are stored in Data:I18n/Message box.tab.

Note

The icon displayed in the message box is clickable and drives to Commons (to see its attributions), but only when the message box is displayed in a "Template:" page (including their talk pages). When the template is displayed in a page belonging to all other namespaces, no link is generated, only the icon is visible directly.

Examples

All possible values for parameter "type"

Examples with more parameters


Cookies help us deliver our services. By using our services, you agree to our use of cookies.