> For the complete documentation index, see [llms.txt](https://docs.kojascripts.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kojascripts.eu/new/hud/guides/progress-bar.md).

# Progress Bar

## Progressbar Functions

### `startProgressbar(data, callback)`

Starts a progress bar and returns a completion status.

**Parameters:**

* **`data.icon`** (string)\
  The FontAwesome icon to display.
* **`data.label`** (string)\
  The text to display on the progress bar.
* **`data.time`** (number)\
  The duration of the progress bar in seconds.
* **`data.animation`** (table)\
  Animation configuration:
  * **`data.animation.dict`** (string): The animation dictionary.
  * **`data.animation.name`** (string): The animation name.
* **`data.inputBlock`** (table)\
  Input blocking configuration:
  * **`data.inputBlock.keys`** (table): A list of keys to block.
* **`data.cancelable`** (boolean)\
  Specifies whether the progress bar can be canceled by pressing `X` (default is `true`).
* **`callback`** (function)\
  A callback function that returns:
  * `true` if the progress bar completed successfully,
  * `false` if it was canceled.

***

### `cancelProgressbar()`

Cancels the active progress bar and stops any associated animation.

***

### Exports

This module exports two functions for use in other scripts:

exports\["script\_name"]:startProgressbar(data, function(isDone) ... end)

`exports["script_name"]:cancelProgressbar()`

***

### Usage Example

```lua
RegisterCommand("testprogress", function(source, args, rawCommand)
    local data = {
        icon = "fa-solid fa-hammer",
        label = "Sample progress...",
        time = 5,
        animation = {
            dict = "amb@world_human_hammering@male@base",
            name = "base"
        },
        inputBlock = {
            keys = {"W", "A", "S", "D"}
        },
        cancelable = true
    }
    
    exports["KOJA_HUD"]:startProgressbar(data, function(isDone)
        if isDone then
            print("Progressbar completed successfully!")
        else
            print("Progressbar was canceled!")
        end
    end)
end, false)
```
