Progress
#
Examples#
Basicexport function App() { return ( <Window> <DemoLayout> <Progress value={75} max={100} animation></Progress> </DemoLayout> </Window> );}
interface IDemoLayoutProps { children?: any[] | any; width?: string; height?: string;}
function DemoLayout(props: IDemoLayoutProps) { const width = props?.width ?? '240dpx'; const height = props?.height ?? '32dpx';
const demoLayout = { columns: `1 ${width} 1`, rows: `1 ${height} 1`, areas: { center: { row: 1, column: 1 }, }, }; return ( <Grid style={{ layout: demoLayout }}> <Grid style={{ area: demoLayout.areas.center }}> {props.children} </Grid> </Grid> );}
In this example, we demonstrate the basic usage of progress.
animation
controls the flowing light.
#
APIexport interface IProgressComponentProps extends IComponentProps { value: number; max?: number; animation?: boolean;}
#
StateUse state
to change the status of progress:
export function App() { return ( <Window> <DemoLayout> <Progress value={75} max={100} animation state={ProgressBarState.Normal} ></Progress> </DemoLayout> </Window> );}
- Normal
- Paused
- Error
- Pulse
![](/Ave-React-Docs/assets/images/progress-basic-90422138c07738a06478ac8c76b833a8.gif)
![](/Ave-React-Docs/assets/images/progress-paused-85c2c5391e3882f83584b8bc0405cb83.gif)
![](/Ave-React-Docs/assets/images/progress-error-969ca51d1b1d99b07553cdc67b358bf7.gif)
![](/Ave-React-Docs/assets/images/progress-pulse-620f86cb311ca951061e394ecb4f5c6f.gif)
#
APIexport enum ProgressBarState { Normal, Paused, Error, Pulse, None,}
#
Stepexport function App() { const [value, setValue] = useState(0); useEffect(() => { setInterval(() => { if (value < 100) { setValue((prev) => prev + 1); // step is 1 } }, 100); }, []); return ( <Window> <DemoLayout> <Progress value={value}></Progress> </DemoLayout> </Window> );}
This example shows how to implement loading: