-
Notifications
You must be signed in to change notification settings - Fork 79
Added new kb article progressbar-add-multiple-labels #2269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ntacheva
merged 7 commits into
master
from
new-kb-progressbar-add-multiple-labels-c846b86576c64d658963519e5f55dc92
Aug 1, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5e02756
Added new kb article progressbar-add-multiple-labels
e6feac7
Update knowledge-base/progressbar-add-multiple-labels.md
ntacheva e45510d
Update knowledge-base/progressbar-add-multiple-labels.md
ntacheva 7cfb06f
chore(progressbar): update page title
ntacheva c85be1b
Update knowledge-base/progressbar-add-multiple-labels.md
ntacheva 6fb7ab2
chore(progressbar): address feedback
ntacheva abb61bf
Update knowledge-base/progressbar-add-multiple-labels.md
ntacheva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
title: Add Multiple Labels in a Blazor ProgressBar | ||
description: Learn how to display two or more labels in a ProgressBar for Blazor. | ||
type: how-to | ||
page_title: How to Add Multiple Labels in a Blazor ProgressBar | ||
slug: progressbar-kb-add-multiple-labels | ||
tags: progressbar, blazor, label, template, css | ||
res_type: kb | ||
ticketid: 1659413 | ||
--- | ||
|
||
## Environment | ||
|
||
<table> | ||
<tbody> | ||
<tr> | ||
<td>Product</td> | ||
<td>ProgressBar for Blazor</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
## Description | ||
|
||
I want to display two labels on my ProgressBar component: one on the left side to show the current progress and another on the right side for the remaining value. | ||
|
||
This KB article also answers the following questions: | ||
|
||
- How can I customize the label inside a ProgressBar in Blazor? | ||
- Is it possible to display two or more labels in a ProgressBar? | ||
- How do I use the label template feature in the ProgressBar for Blazor? | ||
|
||
## Solution | ||
|
||
To display two or more labels in a [ProgressBar]({%slug progressbar-overview%}) for Blazor, use the [Label Template]({%slug progressbar-label%}#template): | ||
1. Declare the `Template` inside the `ProgressBarLabel` label tag. | ||
1. Add your desired labels in separate HTML containers. | ||
1. Use CSS to position them based on your preferences. | ||
|
||
The code snippet below creates a ProgressBar with a custom label that includes two spans: one for the current value and another for the remaining value. The labels are positioned on the left and right sides of the ProgressBar, respectively, using CSS Flexbox for layout. | ||
|
||
````CSHTML | ||
<TelerikProgressBar Value="@PBValue" | ||
Max="@MaxValue" | ||
Class="two-labels-progressbar"> | ||
<ProgressBarLabel Visible="true" Position="@ProgressBarLabelPosition.Center"> | ||
<Template> | ||
<div class="label-container"> | ||
<span>Current value: @(context.Value)%</span> | ||
<span>Remaining: @(MaxValue - context.Value)%</span> | ||
</div> | ||
</Template> | ||
</ProgressBarLabel> | ||
</TelerikProgressBar> | ||
|
||
<style> | ||
.two-labels-progressbar { | ||
width: 700px; | ||
} | ||
|
||
.two-labels-progressbar .label-container { | ||
width: 680px; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
</style> | ||
|
||
@code { | ||
private double MaxValue { get; set; } = 50; | ||
private double PBValue { get; set; } = 10; | ||
} | ||
```` | ||
|
||
## See Also | ||
|
||
* [ProgressBar Label Documentation]({%slug progressbar-label%}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.