Progress
Shows how far along a task is.
Installation
Shadwire follows shadcn/ui's open code model: the component's source is copied into your application and becomes yours. Install it with the CLI:
The progress registry item installs these files:
-
app/components/ui_component.rb -
app/components/ui/progress_component.rb -
app/helpers/ui/progress_helper.rb -
vendor/shadwire/shadwire.css
Haven't installed the CLI yet? gem install shadwire, then shadwire init.
Usage
The server keeps the value within 0..max.
The component has no state in the browser, so to update it live, re-render it with Turbo
Streams or Frames.
Or render the component
Ui::ProgressComponent
directly:
Examples
Default
The value is rendered on the server and exposed through aria-valuenow.
Values
Bars at different stages of completion.
Custom max and height
Use max: for your own scale and classes to adjust the height.
API reference
ui_progress(**options)
wraps
Ui::ProgressComponent.new(**options).
| Argument | Type | Default | Description |
|---|---|---|---|
value |
Numeric | 0 |
The current progress; clamped to 0..max and exposed as aria-valuenow. |
max |
Numeric | 100 |
The top of the scale (aria-valuemax). |
class / class_name |
String | nil |
Extra classes (width, height, …). |
**attrs |
Hash | {} |
Free-form HTML attributes; label it with aria: { label: }. |