Vue UI Components Documentation
The Vue ProgressBar visually indicates the progress of a lengthy operation. This guide adds the Vue ProgressBar (jqxProgressBar) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-scriptsjqwidgets-scripts/jqwidgets-vue3/vue_jqxprogressbar.vue 
In a Vue 3 project (to start one, see Getting started with Vue), add the package:
npm install jqwidgets-scripts
import JqxProgressBar from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxprogressbar.vue';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.base.css';
import 'jqwidgets-scripts/jqwidgets/styles/jqx.tailwind-blue-dark.css';
With <script setup>, an imported component is ready to use in the template. jqx.base.css is required; the second file is a theme, selected with the theme attribute.
The Default Functionality demo as a Single-File Component:
<template>
<div style="font-size: 13px; font-family: Verdana; float: left">
<div style="margin-top: 10px">Horizontal</div>
<JqxProgressBar ref="myHorizontalProgressBar" :width="250" :height="30" :value="50">
</JqxProgressBar>
<div style="margin-top: 10px">Vertical</div>
<JqxProgressBar
ref="myVerticalProgressBar"
:width="30"
:height="250"
:value="50"
:orientation="'vertical'"
>
</JqxProgressBar>
<br />
<div>Enter a value between 0 and 100</div>
<JqxInput ref="valueInputElement"></JqxInput>
<JqxButton @click="onClick()">Update</JqxButton>
<JqxCheckBox @change="onCheckBox($event)"> Show Progress Text </JqxCheckBox>
<JqxCheckBox ref="myRenderCheckBox" @change="onCustomTextCheckBox($event)">
Custom Progress Text
</JqxCheckBox>
</div>
</template>
<script setup>
import { ref } from 'vue';
import JqxProgressBar from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxprogressbar.vue';
import JqxInput from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxinput.vue';
import JqxButton from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxbuttons.vue';
import JqxCheckBox from 'jqwidgets-scripts/jqwidgets-vue3/vue_jqxcheckbox.vue';
const myRenderCheckBox = ref(null);
const valueInputElement = ref(null);
const myHorizontalProgressBar = ref(null);
const myVerticalProgressBar = ref(null);
let valueInput;
let isUpdated;
function renderText(text) {
const isChecked = myRenderCheckBox.value.checked;
if (isChecked) {
return (
"<span class='jqx-rc-all' style='background: #ffe8a6; color: #e53d37; font-style: italic;'>" +
text +
'</span>'
);
} else {
return text;
}
}
function getValueInput() {
return parseInt(valueInputElement.value.val());
}
function onClick() {
const value = getValueInput();
if (!isNaN(value)) {
valueInput = value;
myHorizontalProgressBar.value.val(value);
myVerticalProgressBar.value.val(value);
isUpdated = true;
}
}
function onCheckBox(event) {
const value = getValueInput();
if (value != null && isUpdated) {
myHorizontalProgressBar.value.value = valueInput;
myVerticalProgressBar.value.value = valueInput;
}
const isChecked = event.args.checked;
myHorizontalProgressBar.value.showText = isChecked;
myVerticalProgressBar.value.showText = isChecked;
}
function onCustomTextCheckBox(event) {
const value = getValueInput();
if (value != null && isUpdated) {
myHorizontalProgressBar.value.value = valueInput;
myVerticalProgressBar.value.value = valueInput;
}
myHorizontalProgressBar.value.renderText = renderText;
myVerticalProgressBar.value.renderText = renderText;
// Need to refresh the progressbar
myHorizontalProgressBar.value.showText = false;
myVerticalProgressBar.value.showText = false;
myHorizontalProgressBar.value.showText = true;
myVerticalProgressBar.value.showText = true;
}
</script>
<style>
.jqx-button {
display: inline-block;
}
</style>Options are attributes. Bind values from the script with :, for example :width="850".
Listen to an event with @ and its name. For example, valueChanged: This event is triggered when the value is changed.
<script setup>
function onValueChanged(event) {
console.log(event.args);
}
</script>
<template>
<JqxProgressBar @valueChanged="onValueChanged" />
</template>
Call methods through a template ref. For example, val: Sets or gets the value.
<script setup>
import { ref, onMounted } from 'vue';
const myProgressBar = ref(null);
onMounted(() => {
const value = myProgressBar.value.val();
console.log(value);
});
</script>
<template>
<JqxProgressBar ref="myProgressBar" />
</template>
Every component also has setOptions({ … }) and getOptions('name').