Template:Mbox/doc: Difference between revisions
More actions
←Created page with 'This is the '''Gallery and Image message box''' template. It could be used to construct image and gallery message box templates. <big>Please note that at this mom...' |
no need to hide these boxes on the /doc subpage |
||
| (88 intermediate revisions by 26 users not shown) | |||
| Line 1: | Line 1: | ||
<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 | |||
|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 | |||
== | |3 = image | ||
|3label-en = left image | |||
|3label-ru = изображение слева | |||
|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. | |||
|3d-ru = Изменяет изображение ("none" чтобы не было изображения). Используйте формат: <code><nowiki>[[File:Commons-emblem-urgent.svg|class=noviewer|48px]]</nowiki></code>. Значение по умолчанию зависит от типа. | |||
|3type = content | |||
|3def = | |||
|3stat = optional | |||
== | |4 = imageright | ||
{{ | |4label-en = right image | ||
|text= | |4label-ru = изображение справа | ||
|type= | |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 | |||
}} | }} | ||
{{ | |||
|text=serious | {{mbox | ||
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''serious'''</span></code> → for serious notices | |||
|type=serious | |type=serious | ||
}} | }} | ||
{{ | {{mbox | ||
|text= | |text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''delete'''</span></code> → for deletion notices ''(synonym to'' <code>serious</code>'')'' | ||
|type= | |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 | |||
}} | |||
{{mbox | |||
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''move'''</span></code> → for move requests | |||
|type=move | |||
}} | }} | ||
{{ | |||
|text= | {{mbox | ||
|type= | |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 | |||
}} | }} | ||
{{ | |||
|text=license | {{mbox | ||
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''license'''</span></code> → for licenses | |||
|type=license | |type=license | ||
}} | }} | ||
{{ | |||
|text= | {{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 | ||
}} | }} | ||
{{ | |||
|text=honor | {{mbox | ||
|text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''honor'''</span></code> → for honors such as featured image | |||
|type=honor | |type=honor | ||
}} | }} | ||
{{ | |||
|text= | {{mbox | ||
|type= | |text=<code><nowiki>type=</nowiki><span style="font-size:110%">'''growth'''</span></code> → for other "good" notices | ||
|type=growth | |||
}} | |||
{{mbox | |||
|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 =  <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]] | |||
}} | }} | ||
{{ | |||
|text= | {{Mbox | ||
|type= | |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]] | |||
}} | }} | ||
{{ | |||
|text=message | {{Mbox | ||
|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
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
text | text | The text to be displayed. | empty | required |
type | type | Changes the color depending on the message needed. Each has its own preset image, see #Examples | notice | optional |
image | left image | Override the image (“none” for no image). Use format: [[File:Commons-emblem-urgent.svg|class=noviewer|48px]]. The default depends on the type. | empty | optional |
imageright | right image | Show an image on the right side, similar to the left one (but empty by default). | empty | optional |
textstyle | text style | Override/augment default style of text cell (e.g. alignment — text-align:left; / text-align:right; / text-align:center;). | empty | optional |
style | box style | Override/augment default style of the whole message box. | empty | optional |
class | box class | Augment default CSS classes of the whole message box. Particularly useful if your template uses TemplateStyles. | empty | optional |
lang | language | 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. | empty | optional |
width | box width | 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” | auto | optional |
margin | horizontal margin | Set 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 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 Newly created template documentation and imports Wikipedia's help about TemplateData • Commons-specific information This is used to create message boxes.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
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