Template:Display box


This template is adapted from Template:Robelbox2. The main differences are summarized below.

Robelbox2 Display box
predefined color themes arbitrary colors
border no border
optional icon no icon

The border (and other aspects) could be made customizable in the future, if desired. Also, icons could be added back in; they were removed for simplicity.

Notes

edit
  • This template was originally created for use on Eventmath, and the default colors reflect this.
  • A more flexible template is Colored box, but it would need to be imported to Wikiversity. I didn't find the Colored box template in my initial search before creating this Display box template.--Greg at Higher Math Help (discusscontribs) 08:24, 20 January 2022 (UTC)

Parameters

edit
  • title: Box title. Defaults to "Title" (without quotes).
  • url: URL for link, which appears on the right side of the header. This parameter is optional.
  • linkText: Link text for the link on the right side of the header. Defaults to value of url, if that is provided (does nothing if url not provided).
  • content: Box content. Defaults to a non-breaking space, to prevent the empty content area from collapsing.
  • width: Box width. Defaults to auto.
  • titleBgColor: Title background color. Defaults to #006499.
  • titleColor: Title text color. Defaults to white.
  • linkColor: Link text color. Defaults to titleColor.
  • contentBgColor: Content background color. Defaults to #f8f9fa.
  • contentColor: Content text color. Defaults to black.

Examples

edit

Minimal example

edit

Code

edit
 {{Display box|title=Test title|content=Test content}} 

Output

edit

Test title

Test content


Custom width

edit

Code

edit
 {{Display box|title=Test title|content=Test content|width=50%}} 

Output

edit

Test title

Test content


Custom colors

edit

Any number of the custom color parameters can be set, from none at all, to all four of them.

Code

edit
 {{Display box|title=Test title|content=Test content|contentBgColor=black|contentColor=white}} 

Output

edit

Test title

Test content


edit

Code

edit
 {{Display box|title=Test title|url=https://en.wikiversity.org/wiki/Eventmath|linkText=Eventmath|content=Test content}} 

Output

edit

Test title

Test content


URL only

edit

Code

edit
 {{Display box|title=Test title|url=https://en.wikiversity.org/wiki/Eventmath|content=Test content}} 

Output

edit


edit

Code

edit
 {{Display box|title=Test title|titleBgColor=#DAF3EF|titleColor=black| url=https://en.wikiversity.org/wiki/Eventmath|linkText=Eventmath|linkColor=#f8f9fa|content=Test content}} 

Output

edit

Test title

Test content


Content with a list

edit

Code

edit
 
{{Display box
|title=Test title
|content=
* item 1
* item 2
}}

Output

edit

Test title

  • Item 1
  • Item 2