Skip to content

Commit d57c3f8

Browse files
committed
Docs: add overflow and text color info to progress bar page
1 parent bada2b9 commit d57c3f8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

site/content/docs/5.3/components/progress.md

+25
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ Add labels to your progress bars by placing text within the `.progress-bar`.
7575
</div>
7676
{{< /example >}}
7777

78+
Note that by default, the content inside the `.progress-bar` is controlled with `overflow: hidden`, so it doesn't bleed out of the bar. If your progress bar is shorter than its label, the content will be capped and may become unreadable. To change this behavior, you can use `.overflow-visible` from the [overflow utilities]({{< docsref "/utilities/overflow" >}}), but make sure to also define an explicit [text color]({{< docsref "/utilities/colors#colors" >}}) so the text remains readable.
79+
80+
{{< example >}}
81+
<div class="progress" role="progressbar" aria-label="Example with label" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">
82+
<div class="progress-bar overflow-visible text-dark" style="width: 10%">Long label text for the progress bar, set to a dark color</div>
83+
</div>
84+
{{< /example >}}
85+
7886
## Backgrounds
7987

8088
Use background utility classes to change the appearance of individual progress bars.
@@ -98,6 +106,23 @@ Use background utility classes to change the appearance of individual progress b
98106
{{< partial "callouts/warning-color-assistive-technologies.md" >}}
99107
{{< /callout >}}
100108

109+
If you're adding labels to progress bars with a custom background color, make sure to also set an appropriate [text color]({{< docsref "/utilities/colors#colors" >}}), so the labels remain readable and have sufficient contrast.
110+
111+
{{< example >}}
112+
<div class="progress" role="progressbar" aria-label="Success example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
113+
<div class="progress-bar bg-success" style="width: 25%">25%</div>
114+
</div>
115+
<div class="progress" role="progressbar" aria-label="Info example" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
116+
<div class="progress-bar bg-info text-dark" style="width: 50%">50%</div>
117+
</div>
118+
<div class="progress" role="progressbar" aria-label="Warning example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
119+
<div class="progress-bar bg-warning text-dark" style="width: 75%">75%</div>
120+
</div>
121+
<div class="progress" role="progressbar" aria-label="Danger example" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
122+
<div class="progress-bar bg-danger" style="width: 100%">100%</div>
123+
</div>
124+
{{< /example >}}
125+
101126
## Multiple bars
102127

103128
You can include multiple progress components inside a container with `.progress-stacked` to create a single stacked progress bar. Note that in this case, the styling to set the visual width of the progress bar *must* be applied to the `.progress` elements, rather than the `.progress-bar`s.

0 commit comments

Comments
 (0)