Jump to content

Template:Alternative colored box

From Meta, a Wikimedia project coordination wiki
Template documentation

Usage and parameters

The Alternative colored box template is designed for portal and project pages. It is inspired by the layout of the French Wikipedia's main page. It can also be used on user pages.

Icons can be found at Commons:OOUI icons, and color choices must comply with accessibility standards, requiring a minimum contrast ratio of 4.5 between text and background.

With Wikitext With VisualEditor

Click on "Edit source" and insert the following syntax:

  • Minimal syntax =
{{Alternative colored box
 | title = 
 | content = 
 | link = 
 | class = 
}}
  • Full syntax =
{{Alternative colored box
 | title = 
 | content = 
 | link = 
 | class = 
 | icon = 
 | icon-class = 
}}

Older style and color parameters should be replaced using the class parameter and a dedicated TemplateStyles sheet.

No description yet available.

Usage

{{Alternative colored box |Alternative colored box= }}

Template parameters

ParameterDescriptionDefaultStatus
Alternative colored boxemptyoptional

Additional information

The template is intended to be used in the following namespaces: no namespace specified

The template is intended to be used by the following user groups: no user group specified

This box template is designed for use in portals and project pages, inspired by Wikipedia’s main page.

Template parameters[Edit template data]

This template has custom formatting.

ParameterDescriptionTypeStatus
Titletitle

The title displayed at the top of the box.

Example
Selection
Stringrequired
Contentcontent

The main content inside the box.

Example
Contentrequired
Edit linklink editonly

Name of the page to be edited when clicking the edit link.

Example
Page namesuggested
CSS classesclass

Custom CSS classes defined in TemplateStyles for colors and style.

Example
portalXYZ-style1 portalXYZ-style2
Stringsuggested
Iconicon

Optional icon displayed before the title.

Example
Circle-icons-bar-chart.svg
Filesuggested
Icon CSS classicon-class

Optional CSS class for the icon, e.g., skin-invert for dark mode compatibility.

Suggested values
skin-invert
Stringoptional
Box corner radiusbox-radius

Pixel value for the box's border-radius.

Default
4px
Example
4px
Unknownoptional
Border corner radiusborder-radius

Pixel value for the outer border's border-radius.

Default
4px
Example
4px
Unknownoptional
Border widthborder-width

Pixel value for the thickness of the border.

Default
2px
Example
1px
Unknownoptional
Paddingpadding

Padding value inside the box.

Default
20px
Example
20px
Unknownoptional
Custom CSS stylestyle

Additional inline CSS for the container.

Stringoptional
Flex sizeflex

Flex CSS value to control responsive sizing.

Example
1 1 20em
Contentoptional
Title colortitle-color

Hex code for the text color of the title.

Example
#DD3333
Stringdeprecated
Border colorborder-color

Hex code for the border color.

Example
#DD3333
Stringdeprecated
Shadow colorshadow-color

Hex code for the box shadow.

Example
#DD3333
Stringdeprecated
Title bar colortitle-bar-color

Hex code for the line under the title.

Example
#DD3333
Stringdeprecated
Background colorbackground-color

Hex code for the background color.

Example
#DD3333
Stringdeprecated
Link colorlink-color

Hex code for the edit link color.

Stringdeprecated

Examples

Colors are defined using a TemplateStyles sheet (a `/styles.css` subpage written in CSS). For the examples below, the CSS classes are defined in Template:Alternative colored box/Documentation/styles.css.

Example 1: Default appearance

{{Alternative colored box
| title   = Example 1 (default look)
| content = Lorem ipsum
| link    = Sample page
}}

Example 1 (default look)

Lorem ipsum

Example 2: Custom background and border colors

<templatestyles src="Alternative colored box/Documentation/styles.css"/>
{{Alternative colored box
| title   = Example 2
| content = Lorem ipsum
| link    = Sample page
| class   = alt-colored-box-example-2
}}

Example 3: Custom shadow color

<templatestyles src="Alternative colored box/Documentation/styles.css"/>
{{Alternative colored box
| title   = Example 3
| content = Lorem ipsum
| link    = Sample page
| class   = alt-colored-box-example-3
}}
<templatestyles src="Alternative colored box/Documentation/styles.css"/>
{{Alternative colored box
| title   = Example 4
| content = Lorem ipsum
| link    = Sample page
| class   = alt-colored-box-example-4
| icon    = OOjs UI icon advanced.svg
| icon-class = skin-invert
}}

Example 4

Lorem ipsum

See also

  • start-Colored box-end
  • start-Alternative colored box-end
  • start-Alternative colored box wikidata-end
  • start-Alternative box-end
  • start-Colored bar-end
  • start-Main page frame-end