Difference between revisions of "Template:Progress Bar"

From Official Runecraft Wiki
m (Added missing text section)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
+
<div style="
 +
  width:{{{width|75%}}};
 +
{{#ifeq: {{{center|yes}}} | yes |
 +
  margin:auto;
 +
  text-align:center;}}">
 +
{{#ifeq: {{{header|yes}}} | yes
 +
| <p>
 +
  '''{{#expr: ( {{{1|<noinclude>2</noinclude>0}}} / {{{total|100}}}) * 100 round {{{decimal|1}}}}}%'''
 +
  {{{text|completed <small>(estimate)</small>}}}
 +
  </p>
 
}}
 
}}
 
<p style="border:{{{border|1px solid #c8ccd1}}}; padding:{{{padding|1px}}}; overflow:hidden;">
 
<p style="border:{{{border|1px solid #c8ccd1}}}; padding:{{{padding|1px}}}; overflow:hidden;">
Line 15: Line 24:
 
     ">&nbsp;</span>
 
     ">&nbsp;</span>
 
</p>
 
</p>
 +
</div><noinclude>{{Documentation}}</noinclude>

Latest revision as of 21:18, 2 January 2023

20% completed (estimate)

   

[view | edit | history | purge]Documentation

Usage

{{Progress bar|value}}

This template draws a progress bar. By default, the value to supply as the parameter is the percent, from 0 to 100 (e.g. 1 would mean 1%, .1 would be 0.1%). If a value isn't specified or is invalid, the bar displays 0%. Values greater than 100% will display incorrectly, although the text label will be correct.

Optional parameters

  • height = height of the progress bar in pixels; defaults to 2
  • width = width of the progress bar; defaults to 75%
  • text = message to display after %; defaults to: completed (estimate)
  • total = amount to use as the denominator (instead of 100), allows the template to compute the percentage on the fly
  • header = no (or any value other than "yes", which is the default) suppresses the display of the percentage on the top line
  • color1 = the colour of the filled portion of the progress bar
  • color2 = the colour of the background of the progress bar
  • decimal = the number of decimal places to round to; defaults to 1

Examples

Default configuration

{{Progress bar|5}} : Template:Progress bar

With custom header text

{{Progress bar|5|text=done}} : Template:Progress bar

Without header text

{{Progress bar|80|header=no|text=does not display here}} : Template:Progress bar

Custom height and width

{{Progress bar|80|height=4|width=50%}} : Template:Progress bar

Custom total

{{Progress bar|5|total=5}} : Template:Progress bar

Template:Progress templates

Template:Sandbox other

[view | edit | history | purge]The above documentation is transcluded from Template:Progress Bar/doc.