suiss/uim · React Native Component

Progress

A horizontal bar that shows how far a task has progressed, with an optional label and value.

Progress is an open-source mobile component from suiss/uim for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Progress on iOS in light mode

Progress renders a thin track with an indicator whose width follows value. The width animates with a Reanimated spring, clamped between 0 and 100 percent. Any children, such as ProgressLabel and ProgressValue, are placed in a row above the bar.

Use it for uploads, downloads and other tasks with a known amount of work.

Installation

$ pnpm dlx @esuiss/uim@latest add progress

Manual

  1. Install the dependencies:
npx expo install cn react-native-reanimated react-native-worklets
  1. Add the pieces it builds on: the primitives components/primitives/progress.tsx, components/primitives/use-render.tsx.

  2. Copy the source into components/ui/progress.tsx:

uniwind/components/ui/progress.tsx
import { cn } from "cn"
import Animated, {
  Extrapolation,
  interpolate,
  useAnimatedStyle,
  useDerivedValue,
  withSpring,
} from "react-native-reanimated"
import * as ProgressPrimitive from "@/components/primitives/progress"
import { resolveClassName } from "@/components/primitives/use-render"

function Progress({
  className,
  children,
  trackClassName,
  indicatorClassName,
  1. Update the import paths to match your project.

Usage

import { Progress, ProgressTrack, ProgressIndicator, ProgressLabel, ProgressValue } from "@/components/ui/progress"
<ProgressDemo />

Set value between min and max (0 and 100 by default). Pass null when the progress is unknown.

Add a ProgressLabel and a ProgressValue as children to show a caption and the formatted value; the value is pushed to the end of the row. Format the value with format and locale.

Style the bar with trackClassName and indicatorClassName. ProgressTrack and ProgressIndicator are also exported for custom layouts.

Examples

With label

A bar with a label and a live percentage value.

iOS
Progress (with label) on iOS in light mode

Complete

A bar at 100 percent.

iOS
Progress (complete) on iOS in light mode

Values

Bars at 0, 25, 50, 75 and 100 percent, the last with a custom indicator color.

iOS
Progress (values) on iOS in light mode

API Reference

Progress

Root that holds the value and renders the track and indicator.

ExtendsReact.ComponentProps<typeof ProgressPrimitive.Root>
PropType
About
Extra classes for the track.
Type
string
Default
—
About
Extra classes for the indicator.
Type
string
Default
—

ProgressTrack

Background bar.

ExtendsReact.ComponentProps<typeof ProgressPrimitive.Track>

ProgressIndicator

Animated fill that shows the current value.

ExtendsReact.ComponentProps<typeof ProgressPrimitive.Indicator>

ProgressLabel

Caption text above the bar.

ExtendsReact.ComponentProps<typeof ProgressPrimitive.Label>

ProgressValue

Formatted value text, aligned to the end.

ExtendsReact.ComponentProps<typeof ProgressPrimitive.Value>

Accessibility

  • The root has the progressbar role and reports min, max, the current value and a value text, so VoiceOver and TalkBack announce the progress.
  • Use getAccessibilityValueText to customize the announced text.

Notes

  • The track uses bg-surface-secondary and the indicator bg-accent.
  • Label and value text use text-label and text-label-secondary, with tabular numbers for the value.
  • Light and dark colors follow the system appearance.