Skip to content

LineProgress Linear Progress Bar Component ​

Displays the current progress of an operation or task, such as uploading a file. It is a linear progress bar.

📌 Platform Differences ​

APP(vue)H5WeChat Mini ProgramAlipay Mini Program
✔✔✔✔

🏯 Basic Usage ​

html
<!-- Global usage -->
<hy-line-progress :percentage="30"></hy-line-progress>

Hide Percentage ​

  • The show-text parameter configures whether to display the percentage value inside the progress bar
html
<template>
    <hy-line-progress :percentage="30" :showText="false"></hy-line-progress>
</template>

Custom Height ​

  • height: the height of the progress bar
html
<template>
    <hy-line-progress :percentage="30" height="8"></hy-line-progress>
</template>

Custom Style ​

html
<template>
    <hy-line-progress :percentage="30" activeColor="red" inactiveColor="greed"></hy-line-progress>
</template>

Manual Increment/Decrement ​

  • Increase or decrease the progress by controlling the value of the percentage parameter
html
<template>
    <view style="margin-top: 50px;">
        <hy-line-progress :percentage="percentage" />
        <view style="display: flex;margin-top: 100px;">
            <button @click="computedWidth('minus')">Decrease</button>
            <button @click="computedWidth('plus')">Increase</button>
        </view>
    </view>
</template>

<script setup>
    import { ref } from 'vue';
    import { range } from 'hyfk-app';

    const percentage = ref(30);

    const computedWidth = (type) => {
        if (type === 'plus') {
            percentage.value = range(0, 100, percentage.value + 10);
        } else {
            percentage.value = range(0, 100, percentage.value - 10);
        }
    };
</script>

API ​

LineProgress Props ​

ParameterDescriptionTypeDefault Value
activeColorThe color of the active portion of the progress barstring-
inactiveColorThe background color of the progress bar, gray by defaultstring-
percentageProgress percentage, a numbernumber0
showTextWhether to display the percentage value inside the progress barbooleantrue
heightThe height of the progress bar; default unit is px for numbersnumber | string12
fontSizeFont size; default unit is px for numbersnumber | string-
customStyleCustom external styles to be appliedCSSProperties-
customClassCustom external class namestring-

Slots ​

Slot NameDescriptionAccepted Value
defaultPass in custom display content, which will override the default percentage display-

CSS Variables ​

Variable NameDescriptionDefault Value
--hy-line-progress-text-font-sizeProgress text font size10px
--hy-line-progress-radiusProgress bar border radiusFollows --hy-radius-semicircle (100px)
--hy-line-progress-text-colorProgress text color#ffffff
12:33
battery