Skip to main content

Progress

A progress indicator shows an unspecified wait, or how far a process has run. It follows the Material Design 3 Progress Indicators specification.

Root Native ships two progress indicators with the same API:

  • LinearProgress: a horizontal bar, for a long process with a clear start and end
  • CircularProgress: a circular spinner, for a shorter wait or a compact UI with little horizontal space

Both indicators have two modes:

  • Determinate: pass a progress value between 0 and 1 to show how complete the operation is
  • Indeterminate: omit progress to show a continuous animation when the wait time is unknown

Linear​

import { LinearProgress } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { useEffect, useState } from 'react'
import { View } from 'react-native'

export default function App() {
const [value, setValue] = useState(0.25)

useEffect(() => {
const id = setInterval(() => {
setValue((v) => (v >= 1 ? 0 : Math.min(1, v + 0.07)))
}, 600)
return () => clearInterval(id)
}, [])

return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<View style={{ flex: 1, justifyContent: 'center', padding: 24 }}>
<LinearProgress progress={value} />
</View>
</ThemeProvider>
</SafeAreaProvider>
)
}

In determinate mode the bar has three parts: the active indicator (the filled part on the left), a small gap, the inactive track (the remaining part on the right), and a trailing stop indicator dot that marks the completion target. The dot disappears when progress reaches 1.

Circular​

import { CircularProgress } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { useEffect, useState } from 'react'
import { View } from 'react-native'

export default function App() {
const [value, setValue] = useState(0.25)

useEffect(() => {
const id = setInterval(() => {
setValue((v) => (v >= 1 ? 0 : Math.min(1, v + 0.07)))
}, 600)
return () => clearInterval(id)
}, [])

return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', padding: 24 }}>
<CircularProgress progress={value} />
</View>
</ThemeProvider>
</SafeAreaProvider>
)
}

CircularProgress is built on react-native-svg. Make sure it's installed in your app (npx expo install react-native-svg). The arc grows clockwise from the 12 o'clock position, with a small gap between the active arc and the inactive track.

Indeterminate​

When the duration of an operation is unknown, omit progress to show a continuous animation. LinearProgress slides one segment across the track. CircularProgress spins an arc of fixed length.

import { CircularProgress, LinearProgress } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { View } from 'react-native'

export default function App() {
return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<View style={{ flex: 1, justifyContent: 'center', padding: 24, gap: 24 }}>
<LinearProgress />
<View style={{ alignItems: 'center' }}>
<CircularProgress />
</View>
</View>
</ThemeProvider>
</SafeAreaProvider>
)
}

The animations run on the UI thread through @rootnative/inertia, so they stay smooth while the JS thread is busy.

They also stop when the OS reduce-motion setting is on. That's the point of the setting, but then an indeterminate indicator no longer says "still working". Prefer a determinate progress value wherever you have one. Pair an indeterminate indicator with a text label, so the state survives without the animation.

Size and thickness​

LinearProgress takes thickness to set the track height. CircularProgress takes both size (the outer diameter) and thickness (the stroke width), so you can put a small spinner next to text, or a large one as a page-level indicator.

import { CircularProgress, LinearProgress } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { View } from 'react-native'

export default function App() {
return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<View style={{ flex: 1, justifyContent: 'center', padding: 24, gap: 20 }}>
<LinearProgress progress={0.4} />
<LinearProgress progress={0.4} thickness={8} />

<View style={{ flexDirection: 'row', alignItems: 'center', gap: 20 }}>
<CircularProgress progress={0.4} size={24} thickness={3} />
<CircularProgress progress={0.4} />
<CircularProgress progress={0.4} size={56} thickness={5} />
<CircularProgress progress={0.4} size={72} thickness={6} />
</View>
</View>
</ThemeProvider>
</SafeAreaProvider>
)
}

Wavy​

Pass wavy to draw the active indicator as a travelling wave, the MD3 Expressive form of both indicators. The inactive track stays flat. The wave is flat below 10% and above 95%, so a nearly empty or nearly full indicator looks like a plain bar. Between those points the wave grows in with a spring.

import { CircularProgress, LinearProgress } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { useEffect, useState } from 'react'
import { View } from 'react-native'

export default function App() {
const [value, setValue] = useState(0.25)

useEffect(() => {
const id = setInterval(() => {
setValue((v) => (v >= 1 ? 0 : Math.min(1, v + 0.07)))
}, 600)
return () => clearInterval(id)
}, [])

return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<View style={{ flex: 1, justifyContent: 'center', padding: 24, gap: 24 }}>
<LinearProgress progress={value} wavy />
<LinearProgress wavy />
<View style={{ flexDirection: 'row', gap: 24, justifyContent: 'center' }}>
<CircularProgress progress={value} wavy />
<CircularProgress wavy />
</View>
</View>
</ThemeProvider>
</SafeAreaProvider>
)
}

The wavy LinearProgress is 6dp taller than its thickness, because the wave peaks 3dp each side of the track. The wavy CircularProgress keeps its size: the ring radius shrinks by 2dp so the wave stays inside the container. Both wavy indicators use react-native-svg.

Under the OS reduce-motion setting the wave stands still. The value still moves.

Stop indicator​

LinearProgress shows a trailing dot by default to mark the completion target. Pass stopIndicator={false} to hide it, for a very short bar or a simpler look.

<LinearProgress progress={value} />
<LinearProgress progress={value} stopIndicator={false} />

The dot is hidden in indeterminate mode, and when progress reaches 1.

Custom colors​

containerColor overrides the inactive track, the container of the indicator. contentColor overrides the active indicator drawn on it. Both indicators accept the same overrides, and the pair matches every other component in the library.

import { CircularProgress, LinearProgress } from '@rootnative/components'
import { mdiResolver } from '@rootnative/components/mdi'
import { ThemeProvider } from '@rootnative/core'
import { SafeAreaProvider } from 'react-native-safe-area-context'
import { View } from 'react-native'

export default function App() {
return (
<SafeAreaProvider>
<ThemeProvider iconResolver={mdiResolver}>
<View style={{ flex: 1, justifyContent: 'center', padding: 24, gap: 20 }}>
<LinearProgress
progress={0.6}
containerColor="#C8E6C9"
contentColor="#2E7D32"
/>
<View style={{ alignItems: 'center' }}>
<CircularProgress
progress={0.6}
containerColor="#FFCDD2"
contentColor="#D32F2F"
/>
</View>
</View>
</ThemeProvider>
</SafeAreaProvider>
)
}

Accessibility​

Both components set accessibilityRole="progressbar". In determinate mode, they set accessibilityValue to { min: 0, max: 100, now }, rounded to integers, because the native accessibility APIs require integer values. In indeterminate mode they omit accessibilityValue, which tells assistive technology that the duration is unknown.

Pass accessibilityLabel to say what the progress indicator tracks.

<LinearProgress progress={uploadProgress} accessibilityLabel="Upload progress" />
<CircularProgress accessibilityLabel="Loading user data" />

LinearProgress props​

PropTypeDefaultRequiredDescription
progressnumber-NoProgress value from 0 to 1. When omitted, the indicator shows the indeterminate animation.
containerColorstringtheme.colors.secondaryContainerNoOverride the inactive track color — the indicator's container.
contentColorstringtheme.colors.primaryNoOverride the active indicator color.
thicknessnumber4NoTrack / indicator thickness in dp.
stopIndicatorbooleanNoShow the trailing stop indicator dot. Only applies in determinate mode and is hidden when `progress` reaches 1.
wavybooleanNoDraw the active indicator as a travelling wave (MD3 Expressive). The wave is flat below 10% and above 95%, and the inactive track stays flat. The wavy bar is 6dp taller than `thickness`.

CircularProgress props​

PropTypeDefaultRequiredDescription
progressnumber-NoProgress value from 0 to 1. When omitted, the indicator shows the indeterminate animation.
containerColorstringtheme.colors.secondaryContainerNoOverride the inactive track color — the indicator's container.
contentColorstringtheme.colors.primaryNoOverride the active indicator color.
sizenumber48NoOuter diameter in dp.
thicknessnumber4NoStroke thickness in dp.
wavybooleanNoDraw the active arc as a travelling wave (MD3 Expressive). The wave is flat below 10% and above 95%, and the inactive track stays flat. The wave sits inside `size`, so the ring radius shrinks by 2dp.