Skip to content

Commit 2223bf5

Browse files
ntachevadimodi
andauthored
docs(progressbar):Revamp Overview (#1053)
* docs(progressbar):Revamp Overview * docs(progressbar): remove duplicated example with timer * docs(progressbar):minor fix * docs(progressbar):label customization update * Update components/progressbar/label.md Co-authored-by: Dimo Dimov <[email protected]> * Update components/progressbar/overview.md Co-authored-by: Dimo Dimov <[email protected]> Co-authored-by: Dimo Dimov <[email protected]>
1 parent db7101f commit 2223bf5

File tree

2 files changed

+25
-96
lines changed

2 files changed

+25
-96
lines changed

components/progressbar/label.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ position: 5
1010

1111
# Label for the ProgressBar
1212

13-
The label for the ProgressBar is a text representation of the completion of the task. By default the value of completion is shown as percent `%`. This article explains how to customize the label for the `<TelerikProgressBar>`.
13+
The label for the ProgressBar is a text representation of the completion of the task. By default, the value shows as percent `%` since the default `Max` value is `100`. If you are using a different `Max` value, then override the default label, otherwise the percent value will appear inaccurate.
14+
15+
This article explains how to customize the ProgressBar label position and content.
1416

1517
To access the customization settings use the `<ProgressBarLabel>`. It provides a `Context` which exposes a `Value` parameter which is representation of the current value of the component.
1618

@@ -60,6 +62,6 @@ The `Template` allows you to control the entire rendering of the label for the P
6062

6163
## See Also
6264

63-
* [Live Demo: ProgressBar Overview](https://demos.telerik.com/blazor-ui/progressbar/overview)
65+
* [Live Demo: ProgressBar Label](https://demos.telerik.com/blazor-ui/progressbar/label)
6466
* [Overview]({%slug progressbar-overview%})
6567
* [Indeterminate state]({%slug progressbar-indeterminate-state%})

components/progressbar/overview.md

Lines changed: 21 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ position: 0
1212

1313
The <a href = "https://www.telerik.com/blazor-ui/progressbar" target = "_blank">Blazor ProgressBar component</a> tracks the execution of operations and displays what portion of it is completed. For very long tasks, you can also make it [indeterminate]({%slug progressbar-indeterminate-state%}).
1414

15+
## Creating Blazor ProgressBar
1516

16-
## Basic ProgressBar
17+
1. Use the `<TelerikProgressBar>` tag.
18+
1. Set its `Value` parameter to a `double` to denote how much is completed.
1719

18-
To use the Telerik ProgressBar in your Blazor application:
19-
* add the `<TelerikProgressBar>` tag.
20-
* set its `Value` parameter to denote how much is completed.
21-
22-
![progress-bar basic example](images/progress-bar-basic-example.png)
20+
>caption ProgressBar with maximum and initial values
2321
2422
````CSHTML
2523
@*Set the maximum and the current values of the ProgressBar*@
@@ -32,38 +30,17 @@ To use the Telerik ProgressBar in your Blazor application:
3230
}
3331
````
3432

33+
## Label
3534

36-
>caption Component namespace and reference
37-
38-
````CSHTML
39-
<TelerikProgressBar Max="@MaxValue" Value="@PBValue" @ref="MyProgressBar" />
40-
41-
@code {
42-
Telerik.Blazor.Components.TelerikProgressBar MyProgressBar { get; set; }
43-
44-
public double MaxValue { get; set; } = 50;
45-
public double PBValue { get; set; } = 10;
46-
}
47-
````
48-
49-
## Features
50-
51-
The ProgressBar provides the following features:
35+
The label is a text representation of the current progress. It is rendered inside the ProgressBar and by default shows the component value in percent. The [ProgressBar allows customization of the label position and content]({%slug progressbar-label%}). Use the label template to override the default percent label if the ProgressBar `Max` is not `100`.
5236

53-
* `Class` - the CSS class that will be rendered on the main wrapping element. You can use it to cascade styles more easily.
54-
* `Max` - `double`, defaults to `100` - the maximum value of the ProgressBar. It must be greater than `0`.
55-
* `Value` - `double` - the value of the ProgressBar. This value indicates the progress of the tracked process. It is a fraction of the `Max`.
56-
* `Orientation` - you can control the orientation of the ProgressBar, through the `ProgressBarOrientation` enum, with members:
57-
* `Horizontal` - this is the default value
58-
* `Vertical`
59-
* `Indeterminate` - `bool`, defaults to `false` - see the [Indeterminate]({%slug progressbar-indeterminate-state%}) article for more information.
60-
* `Label` - see the [Label]({%slug progressbar-label%}) article for more information. Shows the `Value` with a `%` sign by default
37+
## Indeterminate State
6138

62-
## Examples
39+
In some scenarios the estimated time of completion is unknown or the progress cannot be strictly measured. The ProgressBar supports continuous animation that can cover these cases. [Read more about the ProgressBar Indeterminate State...]({%slug progressbar-indeterminate-state%})
6340

64-
### Responsive ProgressBar
41+
## Responsive ProgressBar
6542

66-
>caption The ProgressBar will resize with the parent element dimensions when you set its width to 100%
43+
The ProgressBar will resize with the parent element dimensions when you set its width to 100%:
6744

6845
````CSHTML
6946
<div style="width: 50%; border: 1px solid red;">
@@ -78,72 +55,22 @@ The ProgressBar provides the following features:
7855
</div>
7956
````
8057

81-
### Use a Timer to simulate the completion of a task
82-
83-
![progress bar with timer example](images/progress-bar-timer-example.gif)
84-
85-
````CSHTML
86-
@using System.Timers
87-
@implements IDisposable
88-
89-
<TelerikButton ThemeColor="primary" OnClick="@StartProgress">Start</TelerikButton>
90-
91-
<br />
58+
## ProgressBar Parameters
9259

93-
<TelerikProgressBar Max="@MaxValue" Value="@PBValue" Indeterminate="@isIndeterminate">
94-
</TelerikProgressBar>
95-
96-
@code {
97-
public double MaxValue { get; set; } = 100;
98-
public double PBValue { get; set; } = 10;
99-
public bool isIndeterminate { get; set; } = false;
100-
101-
public Timer Timer { get; set; } = new Timer();
102-
103-
public void Dispose()
104-
{
105-
StopProgress();
106-
Timer?.Close();
107-
}
108-
109-
public void StartProgress()
110-
{
111-
if (Timer?.Enabled == false)
112-
{
113-
Timer.Interval = 200;
114-
Timer.Elapsed -= OnTimerElapsedEvent;
115-
Timer.Elapsed += OnTimerElapsedEvent;
116-
Timer.AutoReset = true;
117-
Timer.Start();
118-
}
119-
}
60+
The ProgressBar provides the following features to further customize its behavior:
12061

121-
public void OnTimerElapsedEvent(Object source, ElapsedEventArgs e)
122-
{
123-
if (PBValue < MaxValue)
124-
{
125-
UpdateProgress();
126-
}
127-
else
128-
{
129-
StopProgress();
130-
}
131-
}
62+
@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)
13263

133-
public void UpdateProgress()
134-
{
135-
PBValue += 5;
64+
| Attribute | Type and Default Value | Description |
65+
|----------|----------|----------|
66+
| `Class` | `string` | The CSS class that will be rendered on the main wrapping element. You can use it to cascade styles more easily.
67+
| `Max` | `double` <br/> 100 | The maximum value of the ProgressBar. It must be greater than `0`.
68+
| `Value` | `double` | The value of the ProgressBar. This value indicates the progress of the tracked process. It is a fraction of the `Max`.
69+
| `Orientation` | `ProgressBarOrientation` enum <br/> (`ProgressBarOrientation.Horizontal`) | The orientation of the ProgressBar. Takes a member of the `ProgressBarOrientation` enum - `Horizontal` or `Vertical`.
13670

137-
InvokeAsync(StateHasChanged);
138-
}
71+
## Next Steps
13972

140-
public void StopProgress()
141-
{
142-
Timer?.Stop();
143-
InvokeAsync(StateHasChanged);
144-
}
145-
}
146-
````
73+
* [Customize the ProgressBar Label]({%slug progressbar-label%})
14774

14875
## See Also
14976

0 commit comments

Comments
 (0)