UI Components
Progress
UI component to indicate the progress of a task.
<Progress>
is a UI component that shows a bar to indicate the progress of a task.
See also: ActivityIndicator.
xml
<Progressvalue="75" />
html
<Progressvalue="75"></Progress>
tsx
exportfunctionProgress() {
const [currentValue, setCurrentValue] = React.useState(0)
setInterval(() => {
setCurrentValue(currentValue +10)
if (currentValue >101) setCurrentValue(0)
}, 1000)
return (
<frame>
<pagestyle={styles.container}>
<actionBartitle="Progress"></actionBar>
<gridLayout>
<progressvalue={currentValue} />
</gridLayout>
</page>
</frame>
)
}
tsx
import { createSignal } from'solid-js'
exportconstProgress= () => {
const [count, setCount] =createSignal(0)
setInterval(() => {
setCount(count() +1)
if (count() ===101) setCount(0)
}, 100)
return (
<>
<actionbartitle="Progress">
</actionbar>
<gridlayout>
<progressvalue={count()}></progress>
</gridlayout>
</>
)
}
svelte
<scriptlang="ts">
let currentValue =0
setInterval(() => {
currentValue++
if (currentValue ===101) currentValue =0
}, 100)
</script>
<page>
<actionBartitle="Progress">
</actionBar>
<gridLayoutwidth="100%">
<progressbind:value={currentValue}></progress>
</gridLayout>
</page>
vue
<scriptlang="ts"setup>
import { ref } from'vue'
constcurrentValue=ref(0);
setInterval( () =>{
currentValue.value ++;
if(currentValue.value ===101)
currentValue.value =0;
}, 100);
</script>
<template>
<Page>
<GridLayout>
<Progress:value="currentValue"></Progress>
</GridLayout>
</Page>
</template>
Example β
Styling the Progress bar β
To style the Progress bar, set the backgroundColor
and color
.
The backgroundColor
will be applied to the track, and the color
will be applied to the bar itself.
xml
<Progress
value="75"
backgroundColor="#fff"
color="#000"
/>
Props β
value β
ts
value: number
Gets or sets the current value of the progress bar.
Must be within the range of 0 to maxValue.
maxValue β
ts
maxValue: number
Gets or sets the maximum value of the progress bar.
Defaults to: 100
.
...Inherited β
For additional inherited properties, refer to the API Reference
Native component β
- Previous
- Placeholder
- Next
- ScrollView