Progress
The Bootstrap progress component, implemented in Ruby. Use it like any other matestack component in your apps, pages and components. It offers customizable options to simply achieve what is possible in bootstrap with this component. See below for more information about the possible options.
bs_progress(*args, &block)
bs_progress(*args, &block)Returns a bootstrap progress containing text or content specified by a block. Also the progress is customizable with the following options.
Optional options
:progress- expects a number or a list containing hashes with at least a:value. Other options are:text,:class,:variant,:striped,:animatedand:aria_valuenow.value- Expects an Interger <= 100. Set the current value of the progress bar with this parameterclass- adding custom class for progress barvariant- Specify a variant for the progress. Variant represent bootstraps contextual classes and can have one of the following values::primary, :secondary, :success, :info, :warning, :info, :light, :darkor your custom contextual class. The default is:primarystriped- Expectstrueorfalse. By default is set asfalse. Set this parameter to true for striped progress bar styleanimated- Expectstrueorfalse. By default is set asfalse. Set this parameter to true for animated progress bararia_valuenow- String for attribute aria-valuenowtext- Expects a string with the text that should go inside the<progress-bar>tag.Point of Attention: by using the hash option, your progress bar will have multiple bars (look at example 3)
:text- Expects a string with the text that should go inside the<progress-bar>tag.:valuemin- By default it is set as 0. It describes thearia-valueminattribute:valuemax- By default it is set as 100. It describes thearia-valuemaxattribute:height- Expects an Integer. Set the height of the progress bar in pixelvariant- Specify a variant for the progress. Variant represent bootstraps contextual classes and can have one of the following values::primary, :secondary, :success, :info, :warning, :info, :light, :darkor your custom contextual class. The default is:primarystriped- Expectstrueorfalse. By default is set asfalse. Set this parameter to true for striped progress bar styleanimated- Expectstrueorfalse. By default is set asfalse. Set this parameter to true for animated progress barHtml attributes - all w3c confirm html attributes for div's can be set via options and will be added to the surrounding progress div.
Examples
Example 1: Basic example
bs_progress "25%", height: 20, variant: :success, progress: 25, valuemin: 0, valuemax: 100
# because valuemin and valuemax is set as default. It can be shorten like this:
bs_progress "25%", height: 20, variant: :success, progress: 25returns
<div class="progress" style="height: 20px;">
<div class="progress-bar bg-success" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25%</div>
</div>Example 2: Using striped and animated option
bs_progress "50%", progress: 50, valuemin: 0, valuemax: 100, stripped: true, animated: truereturns
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 50%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">50%</div>
</div>Example 3: Multiple bars
bs_progress progress: [
{ value: 15, text: "15%", variant: :success },
{ value: 30, text: "30%", variant: :info }
], valuemin: 0, valuemax: 100
endreturns
<div class="progress">
<div class="progress-bar bg-success" role="progressbar" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100">15%</div>
<div class="progress-bar bg-info" role="progressbar" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100">30%</div>
</div>Last updated