diff --git a/src/components/progressbar/ProgressBar.js b/src/components/progressbar/ProgressBar.js
index c8a95d72a7..13ae75bb74 100644
--- a/src/components/progressbar/ProgressBar.js
+++ b/src/components/progressbar/ProgressBar.js
@@ -6,7 +6,6 @@ export class ProgressBar extends Component {
static defaultProps = {
id: null,
- value: null,
showValue: true,
unit: '%',
style: null,
@@ -18,6 +17,7 @@ export class ProgressBar extends Component {
id: PropTypes.string,
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
showValue: PropTypes.bool,
+ displayValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
unit: PropTypes.string,
style: PropTypes.object,
className: PropTypes.string,
@@ -25,7 +25,12 @@ export class ProgressBar extends Component {
};
renderLabel() {
- if (this.props.showValue && this.props.value) {
+ if (this.props.showValue && 'displayValue' in this.props) {
+ return (
+
{this.props.displayValue}
+ );
+ }
+ else if (this.props.showValue && 'value' in this.props) {
return (
{this.props.value + this.props.unit}
);
diff --git a/src/showcase/progressbar/ProgressBarDemo.js b/src/showcase/progressbar/ProgressBarDemo.js
index ebca46b3c4..d824606dad 100644
--- a/src/showcase/progressbar/ProgressBarDemo.js
+++ b/src/showcase/progressbar/ProgressBarDemo.js
@@ -11,7 +11,10 @@ export class ProgressBarDemo extends Component {
super();
this.state = {
value1: 0,
- value2: 50
+ value2: 50,
+ value3: 40,
+ totalItems: 5,
+ completedItems: 2
};
}
@@ -58,6 +61,9 @@ export class ProgressBarDemo extends Component {
Static
+ Custom display value
+
+
Indeterminate
@@ -132,6 +138,12 @@ import {ProgressBar} from 'primereact/progressbar';
true |
Show or hide progress bar value. |
+
+ displayValue |
+ string |
+ null |
+ Custom display value |
+
unit |
string |
@@ -215,7 +227,10 @@ export class ProgressBarDemo extends Component {
super();
this.state = {
value1: 0,
- value2: 50
+ value2: 50,
+ value3: 40,
+ totalItems: 5,
+ completedItems: 2
};
}
@@ -262,6 +277,9 @@ export class ProgressBarDemo extends Component {
Static
+ Custom display value
+
+
Indeterminate