Hoppa till huvudinnehåll

ProgressBar

Progressindikator, progresstatus

Progress bar med fördefinierad stil, använder role="progressbar" under huven

import { ProgressBar } from '@midas-ds/components'
<ProgressBar
label='Laddar...'
showValueLabel
value={30}
/>
Laddar...30%

Varianter​

Utan etiketter​

Utelämna label och showValueLabel för att dölja komponentens etiketter. Kom ihåg att ersätta label med aria-label.

<ProgressBar
aria-label='Laddar...'
value={30}
/>

Anpassad valueLabel​

Egenskapen valueLabel och showValueLabel kan användas för att ändra den högerställda etiketten.

<ProgressBar
aria-label='Dina framsteg'
value={2}
maxValue={3}
valueLabel='Steg 2 av 3'
showValueLabel
/>
Steg 2 av 3

Obestämdhet​

Egenskapen isIndeterminate kan användas för att indikera att ett förlopp är obestämt.

<ProgressBar
label='Väntar...'
isIndeterminate
/>
Väntar...

API​

ProgressBar​

NameTypeDefaultDescription
labelstring-

A visual label

labelProps-

Props for the visual label and/or the value label

showValueLabelfalse

Show the value label

className'react-aria-ProgressBar'

The CSS className for the element. A function may be provided to compute the class based on component state.

valuenumber0

The current value (controlled).

minValuenumber0

The smallest value allowed for the input.

maxValuenumber100

The largest value allowed for the input.

isIndeterminate-

Whether presentation is indeterminate when progress isn't known.

formatOptionsNumberFormatOptions{ style: 'percent' }

The display format of the value label.

valueLabel-

The content to display as the value's label (e.g. 1 of 4).

children-

The children of the component. A function may be provided to alter the children based on component state.

style-

The inline style for the element. A function may be provided to compute the style based on component state.

renderDOMRenderFunction<"div", ProgressBarRenderProps>-

Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components.

Requirements:

  • You must render the expected element type (e.g. if <button> is expected, you cannot render an <a>).
  • Only a single root DOM element can be rendered (no fragments).
  • You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
slot-

A slot name for the component. Slots allow the component to receive props from a parent component. An explicit null value indicates that the local props completely override all props received from a parent.