Template:Display box

From Wikiversity
Jump to navigation Jump to search


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 source]

  • 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 source]

  • 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 source]

Minimal example[edit source]

Code[edit source]

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

Output[edit source]

Test title

Test content


Custom width[edit source]

Code[edit source]

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

Output[edit source]

Test title

Test content


Custom colors[edit source]

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

Code[edit source]

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

Output[edit source]

Test title

Test content


URL and link text[edit source]

Code[edit source]

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

Output[edit source]

Test title

Test content


URL only[edit source]

Code[edit source]

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

Output[edit source]

Test content


Custom link color[edit source]

Code[edit source]

 {{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 source]

Test title

Test content


Content with a list[edit source]

Code[edit source]

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

Output[edit source]

Test title

  • Item 1
  • Item 2