> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
