ProgressBar
Used to display the progress status for a task in a horizontal bar.
import { useEffect, useState,} from 'react';import { ProgressBar } from '@fintech-sandpit/ui/react';
const [value, setValue] = useState(51);
// Your logic to update the value goes here// For example, you can use a timer to update the value every second
useEffect(() => { () => { const timer = setInterval(() => { if (value < 100) { setValue(value + 1); } }, 1000);
return () => { clearInterval(timer); }; }, [ value, ],);
return ( <ProgressBar colorScheme="primary" value={value} bordered />);import { ProgressBar } from '@fintech-sandpit/ui/react';
return ( <ProgressBar defaultValue={null} />);<script setup lang="ts">import { onUnmounted, ref,} from 'vue';import { ProgressBar } from '@fintech-sandpit/ui/vue';
const value = ref(51);
// Your logic to update the value goes here// For example, you can use a timer to update the value every second
const timer = setInterval(() => { if (value.value < 100) { value.value++; }}, 1000);
onUnmounted(() => { clearInterval(timer);});</script>
<template> <ProgressBar :value="value" color-scheme="primary" bordered /></template><script setup lang="ts">import { ProgressBar } from '@fintech-sandpit/ui/vue';</script>
<template> <ProgressBar :default-value="null" /></template>| Name | Type | Required | Default | Description |
|---|---|---|---|---|
value | number | null | — | Controlled progress value, between 0 and 100 1 | |
defaultValue | number | null | — | Uncontrolled progress value, between 0 and 100 1 | |
colorScheme | ColorScheme | neutral | Progress bar color scheme | |
size | Size | md | Progress bar size | |
bordered | boolean | false | Whether to show a border |
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
value | number | null | — | Controlled progress value, between 0 and 100 1 | |
default-value | number | null | — | Uncontrolled progress value, between 0 and 100 1 | |
color-scheme | ColorScheme | neutral | Progress bar color scheme | |
size | Size | md | Progress bar size | |
bordered | boolean | false | Whether to show a border |
- If
valueisnull, the progress will be indeterminate, causing the progress bar to spin indefinitely.
type ColorScheme = 'neutral' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger'type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'