> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-framework/modularity/ui-compatibility/reference/components/progressbar.md).

# ProgressBar

Creates an animated progress bar driven by a timer or bind expression.

Generates an animated progress bar that can be driven by a timer (`duration`) or by a bind expression (CFC / JavaScript function) returning `{ status, message }`.

## Syntax

```boxlang
<bx:progressbar 
    name="string"
    bind="string"
    duration="numeric"
    interval="numeric"
    width="numeric"
    height="numeric"
    autoDisplay="boolean"
    onComplete="string"
    onError="string"
    style="string"
    class="string"
    id="string" />
```

## Attributes

| Attribute     | Type      | Required | Description                                                                            | Default |
| ------------- | --------- | -------- | -------------------------------------------------------------------------------------- | ------- |
| `name`        | `string`  | **Yes**  | The control identifier used by `ColdFusion.ProgressBar.*`                              |         |
| `bind`        | `string`  | No\*     | Bind expression (`cfc:component.method()`) that returns `{ status: 0-1, message: "" }` | `""`    |
| `duration`    | `numeric` | No\*     | Total duration in milliseconds for automatic progress                                  | `""`    |
| `interval`    | `numeric` | No       | Polling/update interval in milliseconds                                                | `1000`  |
| `width`       | `numeric` | No       | Width in pixels                                                                        | `400`   |
| `height`      | `numeric` | No       | Height in pixels                                                                       | `""`    |
| `autoDisplay` | `boolean` | No       | Whether to display the bar immediately                                                 | `true`  |
| `onComplete`  | `string`  | No       | JavaScript function name to call on completion                                         | `""`    |
| `onError`     | `string`  | No       | JavaScript function name to call on error (bind mode only)                             | `""`    |
| `style`       | `string`  | No       | Style spec: `bgcolor`, `textcolor`, `progresscolor` (hex without `#`)                  | `""`    |
| `class`       | `string`  | No       | Additional CSS classes                                                                 | `""`    |
| `id`          | `string`  | No       | HTML element ID (defaults to `name`)                                                   |         |

**Note:** Either `duration` (timer-based) or `bind` (poll-based) is required. They are mutually exclusive.

## Examples

### Timer-based progress bar

```boxlang
<bx:progressbar name="uploadBar" duration="5000" onComplete="handleUploadDone" />
```

### Bind-based progress bar

```boxlang
<bx:progressbar name="processBar" bind="cfc:status.getProgress()" interval="2000" onComplete="handleDone" onError="handleError" />
```

### Styled progress bar

```boxlang
<bx:progressbar 
    name="styledBar" 
    duration="3000" 
    width="600"
    height="30"
    style="bgcolor:#eee,textcolor:#333,progresscolor:#4caf50" />
```

## Usage Notes

* Integrates with the `ColdFusion.ProgressBar` JavaScript API (`start`, `stop`, `show`, `hide`) for runtime control
* In bind mode, the bound method must return a struct with `status` (0-1) and `message` keys
* The `style` attribute uses comma-delimited key:value pairs without `#` prefixes for hex colors
* Requires BoxLang AJAX JavaScript files (use `<bx:ajaximport>`)

## Related Components

* [AjaxImport](/boxlang-framework/modularity/ui-compatibility/reference/components/ajaximport.md) - Import required AJAX files


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-framework/modularity/ui-compatibility/reference/components/progressbar.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
