Variants
Example of Progress Bars - default
React documentation
Last modified:
BcProgressBar props
Prop | Type | Required? | Default | Description |
---|---|---|---|---|
value | number | required | A number between 0 to 100 that denotes the percentage of progress completed. ℹ️ You will need to implement your own logic in the parent component. | |
color | string | optional | N/A (blue) | Changes color to either success or branded (orange). See ProgressBar colors. |
isInline | boolean | optional | false | Controls whether the Output component is rendered inline with the progress bar. |
labelPlacement | string | optional | Controls where the progress bar label is rendered above or below the progress bar itself. Either of top or bottom . | |
size | string | optional | Changes bar height/thickness. One of xs , sm , or lg . See ProgressBar sizes. |
Any other props will be passed to .bc-progress-bar__bar
div element.
If the current value cannot be accurately communicated as a number, use aria-valuetext
.
Possible values for color
props
Default color for the progress bar will use $bc-palette-primary-horizon-blue
color variable.
Value | Description |
---|---|
success | Changes the color of the progress bar to use $bc-color-success . |
branded | Changes the color of the progress bar to use $bc-palette-primary-bug-orange . |
Possible values for size
prop
Value | Description |
---|---|
Default height of progress bar is 0.875 rem. | |
xs | Sets the thickness of progress bar to extra small with height of 0.375 rem. |
sm | Sets the thickness of progress bar to small with height of 0.5 rem. |
lg | Sets the thickness of progress bar to large with height of 1 rem. |
Any extended types: NA
BcProgressBar.Label props
BcProgressBar.Label
is required to render BcProgressBar.Output
properly.
Any extended types: HTMLAttributes<HTMLSpanElement>
.
BcProgressBar.Output props
BcProgressBar.Output
is the component to render an output element. It must be wrapped with BcProgressBar.Label
to render as per the design system.
Prop | Type | Required? | Default | Description |
---|---|---|---|---|
value | string | required | Value will be wrapped inside an output element. |
Any extended types: HTMLAttributes<HTMLOutputElement>
except children
.
HTML
Last modified:
The current value is communicated in two main ways:
- Graphically by updating the inline
style
that sets bar’s width as a percentage - With ARIA markup using
aria-valuenow
, and optionally --- in addition ---aria-valuetext
If the current value cannot be accurately communicated as a number, use aria-valuetext
in addition to aria-valuenow
.
If desired, the current value can also be displayed with the progress bar as an <output>
. When doing this, establish a labelling relationship between the .bc-progress-bar
and the <output>
using aria-labelledby
. When providing additional labelling or context, wrap only the current value inside the <output>
tag.
If the text value is omitted, you can use aria-label
instead to provide additional context.
- Use
.bc-progress-bar__output
to display a label text above or below the progress bar. - Use
.bc-helper-righttext
to right align the label text. - Use
.bc-helper-centeredtext
to center align the label text.
Design
Last modified:
These are the color, sizing, and layout variants:
Variant | Purpose |
---|---|
.bc-progress-bar--success | Changes the progression color to green (success). |
.bc-progress-bar--branded | Changes the progression color to bugcrowd’s brand (orange). |
.bc-progress-bar--xs | Lowers the height (extra-small) of the progress bar. |
.bc-progress-bar--sm | Lowers the height of the progress bar. |
.bc-progress-bar--lg | Increases the height of the progress bar. |
.bc-progress-bar--inline | Aligns the progress bar and label text horizontally. |
Accessibility
Last modified:
- The
progressbar
role
provides context to the markup used - The range is provided by
aria-valuemin
andaria-valuemax
- The current value is specified using
aria-valuenow
(assistive technologies render this value as a percentage betweenaria-valuemin
andaria-valuemax
) - More context to the value can be given using
aria-valuetext
--- to be used in addition toaria-valuenow
--- when merely providing the current value as a percentage is inadequate to communicate context - Further context via an ARIA label can be given, using one of the following methods:
- If providing a visual text completion value, use
aria-labelledby
to directly reference the<output>
text (.bc-progress-bar__output
) via its ID - When not providing a visual
<output>
, pass the same [human-readable] string as thearia-label
- If providing a visual text completion value, use
Rationale
Last modified:
Progress bars are an intuitive visual graphing pattern for representing the completion of a process as a percentage.
Markup decision: We’re intentionally not using HTML5’s native <progress>
because at time of creation <progress>
wasn’t supported by some browsers in our browser support matrix, and more importantly the ARIA implementation has better screen reader support (see also Accessibility and HTML sections).
See also
Last modified: