Editing
Template:Composition bar/doc
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Documentation subpage}} <!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> {{high-use| 4913 }} This template displays the numeric composition of a thing in terms of its sub-units. For example, it is frequently used as part of {{tl|Infobox political party}} to show the number of seats a given political party holds in a legislature. A single line, flexible width version of this template is available at [[Template:Composition bar compact]]. == Usage == <nowiki>{{</nowiki>Composition bar|''amount''|''total''|''bar-color''|''options...''}} ; amount : The first parameter is the number of sub-units. ; total : The second parameter is the total number of sub-units possible. ; bar-color : (default is light grey) The third parameter is the background color of the left part of the bar - a valid [[web colors|web color]], which can be specified by name, as a [[hex triplet]] (#rrbbgg), or rgb triplet (rgb(0β255,0β255,0β255)).<br />In the case of political parties, most will have their logo color available in {{party color|tlc|political party}} templates. Additional display options: ; background-color=... : (default is transparent) is the background color of the right part of the bar - a valid [[web colors|web color]]. ; border=... : (default is medium grey) is the color of the border, or "none" for no border ; width=... : (default is 100px) a width value for the bar, such as "100%" or "8em" (unitless numbers are interpreted as px) ; per=... : (default is false), when set to any value (true), adds a percentage to the bar as well ; ref=... : (default is blank), may be used to add a reference/citation for the numbers. == Examples == {| |- ! Code !! Result |- | style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|red}}</nowiki></code> | {{Composition bar|50|100|red}} |- | style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|red|background-color=#DDD|border=none}}</nowiki></code> | {{Composition bar|50|100|red|background-color=#DDD|border=none}} |- | style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|#99F|width=85%}}</nowiki></code> | {{Composition bar|50|100|#99F|width=85%}} |- | style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|{{party color|Green Party (UK)}}}}</nowiki></code> | {{Composition bar|50|100|{{party color|Green Party (UK)}}}} |- | style="font-size: 95%"| <code><nowiki>{{Composition bar|50|100|rgb(255,255,16)}}</nowiki></code> | {{Composition bar|50|100|rgb(255,255,16)}} |- | style="font-size: 95%"| <code><nowiki>{{Composition bar|75|100|#FF0}}</nowiki></code> | {{Composition bar|75|100|#FF0}} |- | style="font-size: 95%"| <code><nowiki>{{Composition bar|40|100|#F00|per=1}}</nowiki></code> | {{Composition bar|40|100|#F00|per=1}} |- | style="font-size: 95%"| <code><nowiki>{{Composition bar|90|100|#F0F0F0|per=1|background-color=#F00}}</nowiki></code> | {{Composition bar|90|100|#F0F0F0|per=1|background-color=#F00}} |- | style="font-size: 95%"| <code><nowiki>{{Composition bar|90|100|#F0C|per=1}}</nowiki></code> | {{Composition bar|90|100|#F0C|per=1}} |- | style="font-size: 95%"| <code><nowiki>{{Composition bar|0|26|hex=#00BFFF|per=1}}</nowiki></code> | {{Composition bar|0|26|hex=#00BFFF|per=1}} |} == TemplateData == {{TemplateDataHeader}} <templatedata> { "description": "A composition bar.", "params": { "1": { "label": "1", "description": "The number of sub-units.", "type": "string/line", "required": true }, "2": { "label": "2", "description": "The total number of sub-units possible.", "type": "string/line", "required": true }, "3": { "label": "3", "description": "The background color of the left part of the bar - a valid web color, which can be specified by name, as a hex triplet (#rrbbgg), or rgb triplet (rgb(0β255,0β255,0β255)). In the case of political parties, most will have their logo color available in {{party color|political party}} templates.", "default": "#CCCCCC", "type": "string/line", "required": false, "aliases": ["hex"] }, "background-color": { "label": "Background color", "description": "The background color of the right part of the bar - a valid web color.", "default": "transparent", "type": "string/line", "required": false }, "border": { "label": "Border color", "description": "The color of the border, or 'none' for no border", "default": "#AAAAAA", "type": "string/line", "required": false, "aliases": ["border-color"] }, "width": { "label": "Width", "description": "The width of the bar with units, such as 100% or 10em (unitless numbers are interpreted as px)", "default": "100px", "type": "string/line", "required": false }, "per": { "label": "Show percent", "description": "When set to 1 (true), adds a percentage to the bar as well", "default": "0", "type": "string/line", "required": false } } } </templatedata> == See also == * {{tl|Bartable}} * {{tl|Bar chart}} * {{tl|Composition bar compact}} {{Progress templates}} <includeonly>{{When on basepage | <!-- Categories below this line; interwikis at Wikidata --> [[Category:Chart, diagram and graph templates]] [[Category:Wikipedia progress templates]] }}</includeonly>
Edit summary
(Briefly describe your changes)
Please note that all contributions to A2wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
A2wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Both
(
edit
)
Template:Composition bar
(
edit
)
Template:Documentation subpage
(
edit
)
Template:High-use
(
edit
)
Template:Hlist/styles.css
(
edit
)
Template:Icon
(
edit
)
Template:Mbox
(
edit
)
Template:Min
(
edit
)
Template:Navbox
(
edit
)
Template:Order of magnitude
(
edit
)
Template:Party color
(
edit
)
Template:Progress templates
(
edit
)
Template:Sandbox other
(
edit
)
Template:Strong
(
edit
)
Template:TemplateDataHeader
(
edit
)
Template:TemplateData header
(
edit
)
Template:Template link
(
edit
)
Template:Template other
(
edit
)
Template:Template parameter usage
(
edit
)
Template:Terminate sentence
(
edit
)
Template:Tl
(
edit
)
Template:Yesno
(
edit
)
Template:Yesno-no
(
edit
)
Module:Arguments
(
edit
)
Module:Check for unknown parameters
(
edit
)
Module:Delink
(
edit
)
Module:High-use
(
edit
)
Module:Icon
(
edit
)
Module:Icon/data
(
edit
)
Module:Math
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Navbar
(
edit
)
Module:Navbar/configuration
(
edit
)
Module:Navbar/styles.css
(
edit
)
Module:Navbox
(
edit
)
Module:Navbox/configuration
(
edit
)
Module:Navbox/styles.css
(
edit
)
Module:Political party
(
edit
)
Module:Political party/G
(
edit
)
Module:Political party/T
(
edit
)
Module:String
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/C
(
edit
)
Module:Yesno
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Template
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Current events
Random page
About A2wiki
interaction
Help
Community portal
Recent changes
Upload file
Tools
What links here
Related changes
Special pages
Page information