ProgressBar
An indeterminate or determinate progress indicator.
Basic usage
Section titled “Basic usage”// Indeterminate (animated, unknown duration)ProgressBar.builder().build()Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
style | String | — | Inline CSS |
cssClasses | String | — | CSS class names |
Use cases
Section titled “Use cases”// Shown while a background job is runningProgressBar.builder() .style("width: 100%;") .build()ProgressBar is typically shown conditionally during a long operation. Use a state variable to control its visibility and re-render the component tree via a State return value once the operation completes.
boolean loading = false;
@Overridepublic Form component(HttpRequest httpRequest) { var content = new ArrayList<Component>(); if (loading) content.add(ProgressBar.builder().build()); content.add(mainContent); return Form.builder().content(content).build();}
@Overridepublic Object handleAction(String actionId, HttpRequest request) { loading = true; runLongOperation(); loading = false; return new State(this);}