ProgressBar

in namespace DotVVM.Controls.Tailwind.Controls

Displays a progress bar.

Usage & Scenarios

Displays a progress indicator whose Value, Type, and ShowLabel properties can all be configured statically or through bindings.

Sample 1: Values and color types

Shows several Value settings and a few Type variants.

<div class="space-y-4">
    <t:ProgressBar Value="25" />
    <t:ProgressBar Value="50" Type="Success" />
    <t:ProgressBar Value="75" Type="Warning" />
    <t:ProgressBar Value="90" Type="Danger" />
</div>

Sample 2: Bindable value and type

Updates Value and Type through viewmodel bindings.

<div class="space-y-4">
    <t:ProgressBar Value="{value: Progress}" Type="{value: SelectedType}" />

    <div class="flex gap-2">
        <t:Button Type="Primary" Text="Increase" Click="{command: Increase()}" Size="Small" />
        <t:Button Type="Secondary" Text="Reset" Click="{command: Reset()}" Size="Small" />
    </div>

    <div class="flex gap-2 flex-wrap">
        <t:Button Text="Primary" Click="{command: SetType(1)}" Size="Small" />
        <t:Button Text="Success" Click="{command: SetType(3)}" Size="Small" />
        <t:Button Text="Warning" Click="{command: SetType(4)}" Size="Small" />
        <t:Button Text="Danger" Click="{command: SetType(5)}" Size="Small" />
    </div>
</div>
using DotVVM.Controls.Tailwind;
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.tailwind.ProgressBar.sample2
{
    public class ViewModel : DotvvmViewModelBase
    {
        public double Progress { get; set; } = 40;

        public TailwindColor SelectedType { get; set; } = TailwindColor.Primary;

        public void Increase()
        {
            Progress = Progress >= 100 ? 100 : Progress + 10;
        }

        public void Reset()
        {
            Progress = 0;
        }

        public void SetType(int type)
        {
            SelectedType = (TailwindColor)type;
        }
    }
}

Sample 3: Percentage label

Shows ShowLabel as a static value and as a bindable property.

<div class="space-y-4">
    <t:ProgressBar Value="65" Type="Success" ShowLabel="true" />

    <t:ProgressBar Value="80" Type="Primary" ShowLabel="{value: ShowLabel}" />

    <t:CheckBox Text="Show label" Checked="{value: ShowLabel}" />
</div>
using DotVVM.Framework.ViewModel;

namespace DotvvmWeb.Views.Docs.Controls.tailwind.ProgressBar.sample3
{
    public class ViewModel : DotvvmViewModelBase
    {
        public bool ShowLabel { get; set; } = true;
    }
}

Properties

Name Type Description Notes Default Value
property icon ShowLabel Boolean When true, renders a percentage label inside the bar.
attribute
inner element
static value
bindable
default
False
property icon Type TailwindColor Visual color variant of the progress bar.
attribute
inner element
static value
bindable
default
Primary
property icon Value Double Progress percentage (0–100).
attribute
inner element
static value
bindable
default
null
property icon Visible Boolean Gets or sets whether the control is visible. When set to false, `style="display: none"` will be added to this control.
attribute
inner element
static value
bindable
default
True

HTML produced by the control