Skip to main content

ProgressBar

The ProgressBar component in our library is a visual element used to indicate the progress of a task or process within an application. It typically appears as a horizontal bar that fills up gradually as the task progresses, providing users with a visual cue of completion status. ProgressBars are commonly used to represent tasks such as file uploads, downloads, form submissions, or loading screens.

Usage

Basic usage

import {ProgressBar} from 'rn-inkpad';

const MyComponent = () => {
return <ProgressBar />;
};

Props

NameTypeDefaultDescription
backgroundColorstring#FFFFFFBar background color.
borderColorstringBar boder color.
borderRadiusnumber0Round the corners.
heightnumber20Bar height.
progressColorstring#00CC00Progress color.
roundedbooleanfalseRound all corners.
showPercentbooleanfalseShow or hide progress text.
textColorstringProgress text color.
valuenumber0Progress value.

Usage props

import React, {useState} from 'react';
import {View} from 'react-native';

import {Button, ProgressBar} from 'rn-inkpad';

const MyComponent = () => {
const [value, setValue] = useState(0);

const handlePress = () => {
if (value === 100) {
setValue(0);
} else {
setValue(value + 25);
}
};

return (
<View>
<ProgressBar
value={value}
rounded
progressColor="#DB504A"
textColor="#21295C"
showPercent
/>

<Button
text={value === 100 ? 'Reset' : 'Add 25%'}
style={{marginTop: 20}}
rounded
buttonColor="#21295C"
onPress={handlePress}
/>
</View>
);
};

Example with props