Skip to content

Description

Use a ProgressIndicator whenever the user has to wait for more than 150ms. This component is also known as:

  • Indicator (Activity-Indicator)
  • Loader (Pre-loader)
  • Spinner

Demos

Default ProgressIndicator is Circular

Code Editor
<ProgressIndicator />

Default Circular ProgressIndicator

Code Editor
<ProgressIndicator type="circular" />

Circular ProgressIndicator with a label in a horizontal direction

Vennligst vent ...

Code Editor
<ProgressIndicator
  // label="Custom label ..."
  type="circular"
  show_label={true}
  label_direction="horizontal"
/>

Circular ProgressIndicator with a label in a vertical direction

Vennligst vent ...

Code Editor
<ProgressIndicator
  // label="Custom label ..."
  type="circular"
  show_label={true}
  label_direction="vertical"
/>

Shows a large Circular ProgressIndicator with a static 50% in progress

Code Editor
<ProgressIndicator
  type="circular"
  progress="50"
  size="large"
  no_animation
/>

Circular ProgressIndicator with random value

Code Editor
const ChangeValue = () => {
  const [value, setValue] = React.useState(50)
  return (
    <Flex.Horizontal align="center">
      <ProgressIndicator
        type="circular"
        progress={value}
        show_label
        no_animation
      />
      <Button
        left
        size="small"
        variant="secondary"
        onClick={() => setValue(Math.random() * 100)}
      >
        Change
      </Button>
    </Flex.Horizontal>
  )
}
render(<ChangeValue />)
SyntaxError: Unexpected token (1:3)

Circular ProgressIndicator with random progress value to show the transition

Code Editor
const Example = () => {
  const random = (min, max) =>
    Math.floor(Math.random() * (max - min + 1)) + min
  const [progress, setProgressIndicator] = React.useState(random(1, 100))
  React.useEffect(() => {
    const timer = setInterval(
      () => setProgressIndicator(random(1, 100)),
      1e3,
    )
    return () => clearInterval(timer)
  })
  return (
    <ProgressIndicator type="circular" size="large" progress={progress} />
  )
}
render(<Example />)
SyntaxError: Unexpected token (1:3)

Circular ProgressIndicator with random on_complete callback

Code Editor
const Example = () => {
  const random = (min, max) =>
    Math.floor(Math.random() * (max - min + 1)) + min
  const [visible, setVisible] = React.useState(true)
  React.useEffect(() => {
    const timer = setInterval(
      () => setVisible(!visible),
      random(2400, 4200),
    )
    return () => clearTimeout(timer)
  })
  return (
    <ProgressIndicator
      type="circular"
      size="large"
      visible={visible}
      on_complete={() => {
        console.log('on_complete_circular')
      }}
    />
  )
}
render(<Example />)
SyntaxError: Unexpected token (1:3)

Circular ProgressIndicator inside a Dialog

Code Editor
<Dialog
  spacing={false}
  maxWidth="12rem"
  fullscreen={false}
  alignContent="centered"
  hideCloseButton
  triggerAttributes={{
    text: 'Show',
  }}
  preventClose={false}
>
  <ProgressIndicator
    type="circular"
    show_label
    label_direction="vertical"
    top="large"
    bottom="large"
    size="large"
  />
</Dialog>

Default Linear ProgressIndicator

Code Editor
<ProgressIndicator type="linear" />

Small Linear ProgressIndicator

Code Editor
<ProgressIndicator type="linear" size="small" />

Linear ProgressIndicator with a label in a horizontal direction

Vennligst vent ...

Code Editor
<ProgressIndicator
  type="linear"
  // label="Custom label ..."
  show_label={true}
  label_direction="horizontal"
/>

Linear ProgressIndicator with a label in a vertical direction

Vennligst vent ...

Code Editor
<ProgressIndicator
  type="linear"
  // label="Custom label ..."
  show_label={true}
  label_direction="vertical"
/>

Shows a large Linear ProgressIndicator with a static 50% in progress

Code Editor
<ProgressIndicator
  type="linear"
  progress="50"
  size="large"
  no_animation
/>

Linear ProgressIndicator with random value

Code Editor
const ChangeValue = () => {
  const [value, setValue] = React.useState(50)
  return (
    <FormRow centered>
      <ProgressIndicator type="linear" progress={value} no_animation />
      <Button
        left
        size="small"
        variant="secondary"
        onClick={() => setValue(Math.random() * 100)}
      >
        Change
      </Button>
    </FormRow>
  )
}
render(<ChangeValue />)
SyntaxError: Unexpected token (1:3)

Linear ProgressIndicator with random progress value to show the transition

Code Editor
const Example = () => {
  const random = (min, max) =>
    Math.floor(Math.random() * (max - min + 1)) + min
  const [progress, setProgressIndicator] = React.useState(random(1, 100))
  React.useEffect(() => {
    const timer = setInterval(
      () => setProgressIndicator(random(1, 100)),
      1e3,
    )
    return () => clearInterval(timer)
  })
  return <ProgressIndicator type="linear" progress={progress} />
}
render(<Example />)
SyntaxError: Unexpected token (1:3)

Linear ProgressIndicator with random on_complete callback

Code Editor
const Example = () => {
  const random = (min, max) =>
    Math.floor(Math.random() * (max - min + 1)) + min
  const [visible, setVisible] = React.useState(true)
  React.useEffect(() => {
    const timer = setInterval(
      () => setVisible(!visible),
      random(2400, 4200),
    )
    return () => clearTimeout(timer)
  })
  return (
    <ProgressIndicator
      type="linear"
      size="large"
      visible={visible}
      on_complete={() => {
        console.log('on_complete_linear')
      }}
    />
  )
}
render(<Example />)
SyntaxError: Unexpected token (1:3)

Linear ProgressIndicator inside a Dialog

Code Editor
<Dialog
  spacing={false}
  maxWidth="12rem"
  fullscreen={false}
  alignContent="centered"
  hideCloseButton
  triggerAttributes={{
    text: 'Show',
  }}
  preventClose={false}
>
  <ProgressIndicator
    type="linear"
    show_label
    label_direction="vertical"
    top="large"
    bottom="large"
  />
</Dialog>