FANDOM



Template documentation (for the above template, sometimes hidden or invisible)(view) (edit) (history) (purge)


This template is used to create message boxes. It uses the Lua templating language, and more information can be found on the Global Lua Module page.

For a traditional wikitext version of this template, see Mbox on Templates Wiki.

Dependencies

Syntax

All parameters are optional. For examples of how to use these parameters, see Examples below.

Parameter name Description Default
class Additional classes to the root .mbox element.
bordercolor The color of the thick left-most border. Stylesheet default
type Type of mbox as declared as in CSS with variables. Affects color of the thick left-most border.
bgcolor The color of the mbox's background. Stylesheet default
style Additional inline styles to the root .mbox element.
image An image to be added to the left of all text content.
imagewidth The width of the image (height automatically adjusts). 60px
imagelink The link to which the image points (could link to the relevant maintenance category, per example). If not included, the image will be un-clickable.
header The header (bold text placed at the top). This is typically used to very briefly explain the subject of the mbox itself, as when the mbox is closed, only the header will show.
text Non-bold text placed below the header, typically used to explain the subject of the mbox in further or additional detail. When the mbox is closed, this text will be hidden.
comment Smaller non-bold text placed below the main text, typically used to add additional links or context about the notice. When the mbox is closed, this text will be hidden.
aside Text placed within a small allocation on the right side separated by a light gray border. Most commonly used to show shortcuts to the page in question (such as on policy pages). When the mbox is closed, this text will be hidden.
id By default, one close button will close all mboxes on the page. However, to change this, this parameter may be used, given as the name of the mbox implementation (e.g., "Template:Cleanup" would have |id=cleanup).
collapsed By default, the mbox will be uncollapsed, and the full contents will be shown. However, to change this, this parameter may be used to set an mbox as collapsed by default (e.g., |collapsed=true would set the mbox to be collapsed by default).

Examples

Basic mbox

{{mbox
|header      = Header text here
|text        = Normal text here
|bordercolor = red
|id          = test1
}}

Produces:

Header text here
Normal text here

Using types

To use types, CSS variables and helper classes must be added, such as:

:root {
    --type-important: rgba(200, 0, 0, 0.8);
    --type-moderate: rgba(233, 124, 47, 0.8);
    --type-minor: rgba(241, 197, 37, 0.8);
}
 
/* NB: The following helper classes are required after <https://github.com/Wikia/app/commit/db84dac8d9bcaaf5d0bee993b11dc77c6792dc79>. */
 
.mbox.mbox-type-important {
    border-left-color: var(--type-important);
}
 
.mbox.mbox-type-moderate {
    border-left-color: var(--type-moderate);
}
 
.mbox.mbox-type-minor {
    border-left-color: var(--type-minor);
}

If added:

{{mbox
|header = Header text here
|type   = important
|text   = Normal text here
|id     = test2
}}

Produces:

Header text here
Normal text here

Image

{{mbox
|header     = Header text here
|text       = Normal text here
|image      = Wiki.png
|imagelink  = w:c:dev:Global Lua Modules
|imagewidth = 50px
|id         = test3
}}

Produces:

Wiki
Header text here
Normal text here

Aside

{{mbox
|header = Header text here
|type   = important
|text   = Normal text here
|aside  = Aside text here
|id     = test4
}}

Produces:

Header text here
Normal text here
Aside text here

Bit of everything

{{mbox
|header    = Header text here
|text      = Normal text here
|comment   = Comment text here
|image     = Wiki.png
|aside     = Aside text here
|id        = test5
|collapsed = true
}}

Produces:

Wiki
Header text here
Normal text here
Comment text here
Aside text here


The above text is transcluded from Template:Mbox/doc. (edit | history) (How does this work?)

If you're done making changes, please purge the text. (Why?)
Editors can experiment in this template's sandbox (create | edit) and testcases (edit) pages.
Please add categories and interwikis to Template:Mbox/doc. (View all subpages of this page.)

Community content is available under CC-BY-SA unless otherwise noted.