Progress Component
- value: number - Current progress value (required)
- min: number - Minimum value (default: 0)
- max: number - Maximum value (default: 100)
- label: string - Accessible label (default: Basic example)
- class: string - Additional CSS classes (optional)
- showLabel: bool - Whether to show the value as text (optional)
- variant: string - Color variant (primary, success, info, warning, danger) (optional)
- striped: bool - Whether to show striped pattern (optional)
- animated: bool - Whether to animate the stripes (optional)
- textBg: bool - Whether to use text-bg-* classes for better text contrast (optional)
All available options for the Progress component
ThemedComponent::make("feedback/progress")
->addAttribute('value') //Add an attribute to the element. This is a string like 'data-foo="bar"' or multiple attributes in a single string like 'data-foo="bar" data-bar="baz"' (optional)
->addCss('value') //string - Add css styles to the element. This should be '<style> custom-class {...} </style>' (optional)
->addJavaScript('value') //string - Add a script to the element. This is a string like '<script>console.log('Hello World!')</script>' (optional)
->animated('value') //bool - Whether to animate the stripes (optional)
->canSee('value') //bool - Whether the component should be visible or not (optional)
->class('value') //string - Additional CSS classes (optional)
->id('value') //string - The id of the element. If no id is supplied, a random one will be generated (optional)
->label('value') //string - Accessible label (default: Basic example)
->max('value') //number - Maximum value (default: 100)
->min('value') //number - Minimum value (default: 0)
->showLabel('value') //bool - Whether to show the value as text (optional)
->striped('value') //bool - Whether to show striped pattern (optional)
->textBg('value') //bool - Whether to use text-bg-* classes for better text contrast (optional)
->value('value') //number - Current progress value (required)
->variant('value') //string - Color variant (primary, success, info, warning, danger) (optional)
->render();
Simple progress bars with different values
// Basic progress bars
echo ThemedComponent::make('feedback/progress')
->value(0)
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(25)
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(50)
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(75)
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(100)
->render();Progress bars with different color variants
// Progress bar variants
echo ThemedComponent::make('feedback/progress')
->value(25)
->variant('success')
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(50)
->variant('info')
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(75)
->variant('warning')
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(100)
->variant('danger')
->render();
// Progress bar variants with text background
echo ThemedComponent::make('feedback/progress')
->value(25)
->variant('success')
->textBg(true)
->showLabel(true)
->label('Success example')
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(50)
->variant('info')
->textBg(true)
->showLabel(true)
->label('Info example')
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(75)
->variant('warning')
->textBg(true)
->showLabel(true)
->label('Warning example')
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(100)
->variant('danger')
->textBg(true)
->showLabel(true)
->label('Danger example')
->render();Progress bars with striped patterns and animations
// Default striped progress bar
echo ThemedComponent::make('feedback/progress')
->value(10)
->striped(true)
->label('Default striped example')
->class('mb-3')
->render();
// Success striped progress bar
echo ThemedComponent::make('feedback/progress')
->value(25)
->striped(true)
->variant('success')
->label('Success striped example')
->class('mb-3')
->render();
// Info striped progress bar
echo ThemedComponent::make('feedback/progress')
->value(50)
->striped(true)
->variant('info')
->label('Info striped example')
->class('mb-3')
->render();
// Warning striped progress bar
echo ThemedComponent::make('feedback/progress')
->value(75)
->striped(true)
->variant('warning')
->label('Warning striped example')
->class('mb-3')
->render();
// Danger striped progress bar
echo ThemedComponent::make('feedback/progress')
->value(100)
->striped(true)
->variant('danger')
->label('Danger striped example')
->class('mb-3')
->render();
// Animated striped progress bars
echo ThemedComponent::make('feedback/progress')
->value(75)
->striped(true)
->animated(true)
->label('Animated striped example')
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(75)
->striped(true)
->animated(true)
->variant('success')
->label('Success animated example')
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(75)
->striped(true)
->animated(true)
->variant('info')
->label('Info animated example')
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(75)
->striped(true)
->animated(true)
->variant('warning')
->label('Warning animated example')
->class('mb-3')
->render();
echo ThemedComponent::make('feedback/progress')
->value(75)
->striped(true)
->animated(true)
->variant('danger')
->label('Danger animated example')
->render();Progress bars with visible labels and custom ranges
// Progress bar with label
echo ThemedComponent::make('feedback/progress')
->value(25)
->showLabel(true)
->class('mb-3')
->render();
// Progress bar with custom min/max
echo ThemedComponent::make('feedback/progress')
->value(7500)
->min(0)
->max(10000)
->showLabel(true)
->render();The Twig template file for the Progress component
{# Progress Component
- value: number - Current progress value (required)
- min: number - Minimum value (default: 0)
- max: number - Maximum value (default: 100)
- label: string - Accessible label (default: Basic example)
- class: string - Additional CSS classes (optional)
- showLabel: bool - Whether to show the value as text (optional)
- variant: string - Color variant (primary, success, info, warning, danger) (optional)
- striped: bool - Whether to show striped pattern (optional)
- animated: bool - Whether to animate the stripes (optional)
- textBg: bool - Whether to use text-bg-* classes for better text contrast (optional)
#}
<div class="progress {{ content.class|default('') }}"
role="progressbar"
aria-label="{{ content.label|default('Basic example') }}"
aria-valuenow="{{ content.value|default(0) }}"
aria-valuemin="{{ content.min|default(0) }}"
aria-valuemax="{{ content.max|default(100) }}">
<div class="progress-bar{% if content.variant %}{% if content.textBg %} text-bg-{{ content.variant }}{% else %} bg-{{ content.variant }}{% endif %}{% endif %}{% if content.striped %} progress-bar-striped{% endif %}{% if content.animated %} progress-bar-animated{% endif %}"
style="width: {{ ((content.value|default(0)|number_format) / (content.max|default(100)|number_format) * 100)|round }}%">
{% if content.showLabel %}{{ content.value|default(0) }}%{% endif %}
</div>
</div>