import{_ as s,o as a,c as e,Q as n}from"./chunks/framework.4313453f.js";const h=JSON.parse('{"title":"Progressbar","description":"","frontmatter":{"outline":"deep"},"headers":[],"relativePath":"references/progressbar.md","filePath":"references/progressbar.md","lastUpdated":null}'),l={name:"references/progressbar.md"},o=n(`

Progressbar

Progressbars are objects that visually display the current state of your progress. They always represent progress as a percentage (0 to 100%), regardless of their size. To represent progress in other units, you need to perform a simple conversion: currentValue / maxValue * 100.

Properties

PropertyTypeDescription
progressnumberCurrent progress displayed by the progress bar, typically between 0 and 100.
progressBackgroundcolorColor of the background which is not filled by the progress.
minValuenumberThe starting value of the progress, typically 0.
maxValuenumberThe ending value representing completion, which corresponds to 100% on the progress bar.

Example

Here’s how to implement and use the Progressbar object within the Basalt framework:

lua
local main = basalt.createFrame()
local aProgressbar = main:addProgressbar()

-- Set the initial properties
aProgressbar:setMinValue(0)
aProgressbar:setMaxValue(1000) -- Assuming our task's total workload is 1000 units

-- As your task progresses, update the progress displayed
local currentTaskValue = 500 -- This represents the task's current state

-- Convert the currentTaskValue to a percentage and set it as the progress
local percentageProgress = (currentTaskValue / aProgressbar:getMaxValue()) * 100
aProgressbar:setProgress(currentTaskValue)
local main = basalt.createFrame()
local aProgressbar = main:addProgressbar()

-- Set the initial properties
aProgressbar:setMinValue(0)
aProgressbar:setMaxValue(1000) -- Assuming our task's total workload is 1000 units

-- As your task progresses, update the progress displayed
local currentTaskValue = 500 -- This represents the task's current state

-- Convert the currentTaskValue to a percentage and set it as the progress
local percentageProgress = (currentTaskValue / aProgressbar:getMaxValue()) * 100
aProgressbar:setProgress(currentTaskValue)

this example, the task has a total workload of 1000 units. When half of it, or 500 units, is complete, the progress bar reflects this by filling up to 50%.

`,8),r=[o];function p(t,c,y,i,E,d){return a(),e("div",null,r)}const g=s(l,[["render",p]]);export{h as __pageData,g as default};