Prerequisites: run component setup (view_primitives:install) once per app.
Horizontal progress bar with accessible ARIA attributes.
rails g view_primitives:add progressCreates app/components/ui/progress_component.rb.
Refresh after a gem upgrade:
rails g view_primitives:update --only progress<%# 40% complete %>
<%= ui :progress, value: 40 %>
<%# Custom max %>
<%= ui :progress, value: 3, max: 10 %>
<%# Custom width %>
<%= ui :progress, value: 75, class: "w-64" %>valueis clamped between0andmax- The inner bar width is calculated as
(value / max) * 100% - Renders with
role="progressbar"andaria-valuenow/aria-valuemin/aria-valuemax
| Option | Type | Default | Description |
|---|---|---|---|
value |
Numeric | 0 |
Current progress value |
max |
Numeric | 100 |
Maximum value |
**html_attrs |
Hash | — | Forwarded to the outer track <div> |