Movatterモバイル変換


[0]ホーム

URL:


Framework:


Hire UsGet CoreUI PRO all-access

React Progress Component

Progress

Documentation and examples for using React progress bars featuring support for stacked bars, animated backgrounds, and text labels.

Other Frameworks

CoreUI components are available as native Angular, Bootstrap (Vanilla JS), and Vue components. To learn more please visit the following pages.

Example#

Progress components are built with two HTML elements, some CSS to set the width, and a few attributes. We don't usethe HTML5<progress> element, ensuring you can stack progress bars, animate them, and place text labels over them.

Basic usage#

Labels#

Add labels to your progress bars by placing text within the<CProgressBar>.

25%

Please note that the default setting for the content within the<CProgressBar /> is to be limited by theoverflow: hidden property, preventing it from extending beyond the bar's boundaries. If the progress bar is shorter than its label, the content will be truncated and could be difficult to read. To modify this behavior, you can utilize the.overflow-visible class from the overflow utilities. However, it is important to specify a specific text color to ensure readability. It's worth noting that this approach currently does not consider color modes.

Long label text for the progress bar, set to a dark color

Sincev4.9.0 you can also use theprogressBarClassName property directly on the<CProgress /> component to achieve the same.

<CProgressprogressBarClassName="overflow-visible text-dark px-2"color="success"value={10}>Long label text for the progress bar, set to a dark color</CProgress>

Height#

We only set aheight value on the<CProgress>, so if you change that value the inner<CProgressBar> will automatically resize accordingly.

Backgrounds#

Usecolor prop to change the appearance of individual progress bars.

Ensure that when you incorporate labels into progress bars featuring a custom background color, you also select an appropriate text color to ensure readability and maintain adequate contrast for the labels.

25%
50%
75%
100%

Sincev4.9.0 you can also use theprogressBarClassName property directly on the<CProgress /> component to achieve the same.

<CProgresscolor="success"value={25}>25%</CProgress>
<CProgresscolor="info"progressBarClassName="text-dark"value={50}>50%</CProgress>
<CProgresscolor="warning"progressBarClassName="text-dark"value={75}>75%</CProgress>
<CProgresscolor="danger"value={100}>100%</CProgress>

Multiple bars#

Include multiple progress bars in a progress component if you need. Inv4.9.0

New markup in v4.9.0

In version 4.9.0, we introduced a new<CProgressStacked> component to more logically wrap multiple progress bars into a single stacked progress bar. The previous structure will continue to work until the next major version.

Previous markup

<CProgress>
<CProgressBarvalue={15}/>
<CProgressBarcolor="success"value={30}/>
<CProgressBarcolor="info"value={20}/>
</CProgress>

Striped#

Addvariant="striped" to any<CProgressBar> to apply a stripe via CSS gradient over the progress bar's background color.

Animated stripes#

The striped gradient can also be animated. Addanimated property to<CProgressBar> to animate the stripes right to left via CSS3 animations.

API#

Check out the documentation below for a comprehensive guide to all the props you can use with the components mentioned here.

CoreUI for React is Open Source UI Components Library for React.js.

CoreUI code licensedMIT, docsCC BY 3.0. CoreUI PRO requires acommercial license.


[8]ページ先頭

©2009-2025 Movatter.jp