suiss/ui
  • Docs
  • Components
  • Patterns
  • Interactions
  • Charts
  • Blocks
  • AI
GitHubCreate
DocsComponentsPatternsInteractionsChartsBlocksAICreate
Components84
  • Overview
  • Accordion
  • Alert
  • Alert Dialog
  • Alert Sheet
  • Amount Input
  • Aspect Ratio
  • Attachment
  • Avatar
  • Badge
  • Bottom Bar
  • Breadcrumb
  • Bubble
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Chip
  • Code Block
  • Collapsible
  • Combobox
  • Command
  • Context Menu
  • Dialog
  • Direction
  • Drawer
  • Dropdown Menu
  • Empty
  • FAB
  • Field
  • Fullscreen Menu
  • Haptics
  • Header
  • Hover Card
  • Icon
  • Input
  • Input Accessory Bar
  • Input Group
  • Input OTP
  • Item
  • Kbd
  • Keyboard Scroll View
  • Keypad
  • Label
  • Marker
  • Menubar
  • Message
  • Message Scroller
  • Native Select
  • Navigation Menu
  • Page Indicator
  • Pagination
  • Pin Pad
  • Popover
  • Progress
  • QR Scanner
  • Questionnaire
  • Radio Group
  • Resizable
  • Screen
  • Scroll Area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature Pad
  • Skeleton
  • Slider
  • Spinner
  • Switch
  • Tab Bar
  • Table
  • Tabs
  • Text
  • Textarea
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Trace
  • Wheel Picker
  • Widget

suiss/ui · Component

Progress

A horizontal bar that shows the completion of a task.

Progress is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.

import { Progress } from "@/components/ui/progress"

export default function ProgressDemo() {
  return <Progress className="w-80" value={60} aria-label="Upload progress" />
}

Progress wraps the progress primitive of the chosen base. Progress is the root and always renders a ProgressTrack containing a ProgressIndicator after its children. Add a ProgressLabel to name the bar and a ProgressValue to show the formatted value; they sit on one row above the track.

Use Progress for determinate or indeterminate task progress.

Installation

$ pnpm dlx shadcn@latest add @esuiss/progress

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add progress
  1. Install the following dependencies and add the cn helper:
$ pnpm add @base-ui/react
  1. Copy and paste the following code into your project.
components/ui/progress.tsx
"use client"

import { Progress as ProgressPrimitive } from "@base-ui/react/progress"
import { cn } from "@/lib/utils"

function Progress({
  className,
  children,
  value,
  locale = "en-US",
  ...props
}: ProgressPrimitive.Root.Props) {
  return (
    <ProgressPrimitive.Root
      value={value}
      locale={locale}
  1. Update the import paths to match your project setup.

Usage

import {
  Progress,
  ProgressIndicator,
  ProgressLabel,
  ProgressTrack,
  ProgressValue,
} from "@/components/ui/progress"
<div className="w-80">
  <Progress value={60} aria-label="Upload progress" />
</div>

Composition

Use the following composition to build a Progress:

Progress
├── ProgressLabel
└── ProgressValue

Examples

With label

Add a ProgressLabel and a ProgressValue as children to show a label and the current value on one row above the track.

import {
  Progress,
  ProgressLabel,
  ProgressValue,
} from "@/components/ui/progress"

export default function ProgressWithLabel() {
  return (
    <Progress className="w-80" value={42}>
      <ProgressLabel>Uploading files</ProgressLabel>
      <ProgressValue />
    </Progress>
  )
}

Complete

A labelled bar with value set to 100.

import {
  Progress,
  ProgressLabel,
  ProgressValue,
} from "@/components/ui/progress"

export default function ProgressComplete() {
  return (
    <Progress className="w-80" value={100}>
      <ProgressLabel>Uploading files</ProgressLabel>
      <ProgressValue />
    </Progress>
  )
}

Indeterminate

A labelled bar with value={null} for work of unknown length.

A labelled bar with isIndeterminate for work of unknown length.

import { Progress, ProgressLabel } from "@/components/ui/progress"

export default function ProgressIndeterminate() {
  return (
    <Progress className="w-80" value={null}>
      <ProgressLabel>Preparing export</ProgressLabel>
    </Progress>
  )
}

Accessibility

  • The root has the progressbar role with aria-valuenow reflecting the value.
  • ProgressLabel provides the accessible name. Without it, pass aria-label.
  • When value is null, aria-valuenow is omitted to signal an indeterminate state.
  • With isIndeterminate, aria-valuenow is omitted to signal an indeterminate state.

API Reference

Progress

The root that holds the value and renders the track and indicator.

PropTypeDefault
valuenumber | null—
minnumber0
maxnumber100
PropTypeDefault
valuenumber | nullnull
maxnumber100
PropTypeDefault
valuenumber0
minValuenumber0
maxValuenumber100
isIndeterminatebooleanfalse

Also accepts the props of the primitive part it wraps.

Pass value as a number between min and max; min is the value of an empty bar and max of a full one. Set value={null} for an indeterminate bar when the amount of work is unknown.

Pass value as a number between 0 and max, the value of a full bar. Leave value out, or set value={null}, for an indeterminate bar when the amount of work is unknown.

Pass value as a number between minValue and maxValue, the values of an empty and a full bar. Set isIndeterminate for an indeterminate bar when the amount of work is unknown.

The track and indicator are rendered for you after the children, so ProgressTrack and ProgressIndicator are not needed inside Progress. The indicator animates width changes.

ProgressTrack

The full-width rail behind the indicator.

Also accepts the props of the primitive part it wraps.

ProgressIndicator

The filled portion of the track that reflects the value.

Also accepts the props of the primitive part it wraps.

ProgressLabel

Text that names the progress bar.

Also accepts the props of the primitive part it wraps.

ProgressValue

The formatted current value, aligned to the end of the row.

Also accepts the props of the primitive part it wraps.

The value is shown as a percentage by default.

Each part sets a data-slot, such as progress-track or progress-indicator, for styling.

Web

Web preview

import * as React from "react"
import { Progress } from "@/components/ui/progress"

export default function ProgressDemoExample() {
  const [value, setValue] = React.useState(13)
  React.useEffect(() => {
    const timer = setTimeout(() => setValue(66), 500)
    return () => clearTimeout(timer)
  }, [])
  return <Progress value={value} />
}
import SwiftUI

struct ProgressDelayed: View {
  @State private var value = 13.0

  var body: some View {
    ProgressView(value: value, total: 100)
      .progressViewStyle(.bar)
      .task {
        try? await Task.sleep(for: .milliseconds(500))
        value = 66
      }
  }
}
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import com.esuiss.ui.components.Progress
import kotlinx.coroutines.delay

@Composable
fun ProgressDefault() {
    var value by rememberSaveable { mutableFloatStateOf(13f) }
    LaunchedEffect(Unit) {
        delay(500)

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 shadcn@latest add @esuiss/progress

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add progress
$ pnpm dlx shadcn@latest add @esuiss/progress

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add progress --platform swift
$ pnpm dlx shadcn@latest add @esuiss/progress

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add progress --platform kotlin
  1. Install the following dependencies:
npx expo install cn react-native-reanimated react-native-worklets
  1. Copy the primitives it uses into components/primitives:
uniwind/components/primitives/hooks.ts
import * as React from "react"
import { BackHandler } from "react-native"

function useEffectEvent<TArgs extends readonly unknown[], TResult>(
  callback: (...args: TArgs) => TResult
): (...args: TArgs) => TResult {
  const callbackRef = React.useRef(callback)

  React.useLayoutEffect(() => {
    callbackRef.current = callback
  })

  return React.useCallback(
    (...args: TArgs): TResult => callbackRef.current(...args),
    []
  )
uniwind/components/primitives/merge-props.ts
type AnyProps = Record<string, unknown>

type PropsGetter = (previous: AnyProps) => object

type MergePropsInput = object | PropsGetter | null | undefined

type Handler = (...args: unknown[]) => unknown

type StyleCallback = (state: never) => unknown

const EMPTY_PROPS: AnyProps = {}

function isEventHandler(key: string, value: unknown) {
  const code0 = key.charCodeAt(0)
  const code1 = key.charCodeAt(1)
  const code2 = key.charCodeAt(2)
uniwind/components/primitives/progress.tsx
import * as React from "react"
import { Text, View } from "react-native"
import type { BaseUIComponentProps } from "./types"
import { useRender } from "./use-render"

type ProgressStatus = "indeterminate" | "progressing" | "complete"

interface RootState {
  status: ProgressStatus
}

type TrackState = RootState

type IndicatorState = RootState

type LabelState = RootState
uniwind/components/primitives/types.ts
import type * as React from "react"
import type {
  GestureResponderEvent,
  HostInstance,
  NativeSyntheticEvent,
  StyleProp,
  ViewStyle,
} from "react-native"

type Side = "top" | "bottom" | "left" | "right"
type Align = "start" | "center" | "end"
type Orientation = "horizontal" | "vertical"

type ComponentRenderFn<Props, State> = (
  props: Props,
  state: State
uniwind/components/primitives/use-render.tsx
import * as React from "react"
import { useComposedRefs } from "./hooks"
import { mergeClassNames, mergeProps, mergeStyles } from "./merge-props"
import type { ClassNameProp, RenderProp, StyleValue } from "./types"

type AnyProps = Record<string, unknown>

type RefInput<T> = React.Ref<T> | undefined

interface UseRenderParameters<State, RefType = unknown, Props = AnyProps> {
  defaultComponent?: React.ElementType | undefined
  render?: RenderProp<Props, State> | undefined
  props?: object | readonly (object | null | undefined)[] | undefined
  state?: State | undefined
  ref?: RefInput<RefType> | readonly RefInput<RefType>[] | undefined
  className?: ClassNameProp<State>
  1. Copy and paste the following code into components/ui/progress.tsx:
uniwind/components/ui/progress.tsx
import { cn } from "cn"
import * as React from "react"
import Animated, {
  useAnimatedStyle,
  useSharedValue,
  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,
  ...props
  1. Update the import paths to match your project setup.
  1. Install the following dependencies:
npx expo install cn react-native-reanimated react-native-worklets
  1. Copy the primitives it uses into components/primitives:
nativewind/components/primitives/hooks.ts
import * as React from "react"
import { BackHandler } from "react-native"

function useEffectEvent<TArgs extends readonly unknown[], TResult>(
  callback: (...args: TArgs) => TResult
): (...args: TArgs) => TResult {
  const callbackRef = React.useRef(callback)

  React.useLayoutEffect(() => {
    callbackRef.current = callback
  })

  return React.useCallback(
    (...args: TArgs): TResult => callbackRef.current(...args),
    []
  )
nativewind/components/primitives/merge-props.ts
type AnyProps = Record<string, unknown>

type PropsGetter = (previous: AnyProps) => object

type MergePropsInput = object | PropsGetter | null | undefined

type Handler = (...args: unknown[]) => unknown

type StyleCallback = (state: never) => unknown

const EMPTY_PROPS: AnyProps = {}

function isEventHandler(key: string, value: unknown) {
  const code0 = key.charCodeAt(0)
  const code1 = key.charCodeAt(1)
  const code2 = key.charCodeAt(2)
nativewind/components/primitives/progress.tsx
import * as React from "react"
import { Text, View } from "react-native"
import type { BaseUIComponentProps } from "./types"
import { useRender } from "./use-render"

type ProgressStatus = "indeterminate" | "progressing" | "complete"

interface RootState {
  status: ProgressStatus
}

type TrackState = RootState

type IndicatorState = RootState

type LabelState = RootState
nativewind/components/primitives/types.ts
import type * as React from "react"
import type {
  GestureResponderEvent,
  HostInstance,
  NativeSyntheticEvent,
  StyleProp,
  ViewStyle,
} from "react-native"

type Side = "top" | "bottom" | "left" | "right"
type Align = "start" | "center" | "end"
type Orientation = "horizontal" | "vertical"

type ComponentRenderFn<Props, State> = (
  props: Props,
  state: State
nativewind/components/primitives/use-render.tsx
import * as React from "react"
import { useComposedRefs } from "./hooks"
import { mergeClassNames, mergeProps, mergeStyles } from "./merge-props"
import type { ClassNameProp, RenderProp, StyleValue } from "./types"

type AnyProps = Record<string, unknown>

type RefInput<T> = React.Ref<T> | undefined

interface UseRenderParameters<State, RefType = unknown, Props = AnyProps> {
  defaultComponent?: React.ElementType | undefined
  render?: RenderProp<Props, State> | undefined
  props?: object | readonly (object | null | undefined)[] | undefined
  state?: State | undefined
  ref?: RefInput<RefType> | readonly RefInput<RefType>[] | undefined
  className?: ClassNameProp<State>
  1. Copy and paste the following code into components/ui/progress.tsx:
nativewind/components/ui/progress.tsx
import { cn } from "cn"
import * as React from "react"
import Animated, {
  useAnimatedStyle,
  useSharedValue,
  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,
  ...props
  1. Update the import paths to match your project setup.
  1. Install the following dependencies:
npx expo install react-native-reanimated react-native-worklets
  1. Copy the primitives it uses into components/primitives:
stylesheet/components/primitives/hooks.ts
import * as React from "react"
import { BackHandler } from "react-native"

function useEffectEvent<TArgs extends readonly unknown[], TResult>(
  callback: (...args: TArgs) => TResult
): (...args: TArgs) => TResult {
  const callbackRef = React.useRef(callback)

  React.useLayoutEffect(() => {
    callbackRef.current = callback
  })

  return React.useCallback(
    (...args: TArgs): TResult => callbackRef.current(...args),
    []
  )
stylesheet/components/primitives/merge-props.ts
type AnyProps = Record<string, unknown>

type PropsGetter = (previous: AnyProps) => object

type MergePropsInput = object | PropsGetter | null | undefined

type Handler = (...args: unknown[]) => unknown

type StyleCallback = (state: never) => unknown

const EMPTY_PROPS: AnyProps = {}

function isEventHandler(key: string, value: unknown) {
  const code0 = key.charCodeAt(0)
  const code1 = key.charCodeAt(1)
  const code2 = key.charCodeAt(2)
stylesheet/components/primitives/progress.tsx
import * as React from "react"
import { Text, View } from "react-native"
import type { BaseUIComponentProps } from "./types"
import { useRender } from "./use-render"

type ProgressStatus = "indeterminate" | "progressing" | "complete"

interface RootState {
  status: ProgressStatus
}

type TrackState = RootState

type IndicatorState = RootState

type LabelState = RootState
stylesheet/components/primitives/types.ts
import type * as React from "react"
import type {
  GestureResponderEvent,
  HostInstance,
  NativeSyntheticEvent,
  StyleProp,
  ViewStyle,
} from "react-native"

type Side = "top" | "bottom" | "left" | "right"
type Align = "start" | "center" | "end"
type Orientation = "horizontal" | "vertical"

type ComponentRenderFn<Props, State> = (
  props: Props,
  state: State
stylesheet/components/primitives/use-render.tsx
import * as React from "react"
import { useComposedRefs } from "./hooks"
import { mergeClassNames, mergeProps, mergeStyles } from "./merge-props"
import type { ClassNameProp, RenderProp, StyleValue } from "./types"

type AnyProps = Record<string, unknown>

type RefInput<T> = React.Ref<T> | undefined

interface UseRenderParameters<State, RefType = unknown, Props = AnyProps> {
  defaultComponent?: React.ElementType | undefined
  render?: RenderProp<Props, State> | undefined
  props?: object | readonly (object | null | undefined)[] | undefined
  state?: State | undefined
  ref?: RefInput<RefType> | readonly RefInput<RefType>[] | undefined
  className?: ClassNameProp<State>
  1. Copy and paste the following code into components/ui/progress.tsx:
stylesheet/components/ui/progress.tsx
import * as React from "react"
import { type StyleProp, StyleSheet, type ViewStyle } from "react-native"
import Animated, {
  useAnimatedStyle,
  useSharedValue,
  withSpring,
} from "react-native-reanimated"
import * as ProgressPrimitive from "@/components/primitives/progress"
import { fontSize, radius, useTheme } from "@/components/ui/theme"

const styles = StyleSheet.create({
  root: {
    width: "100%",
    flexDirection: "row",
    flexWrap: "wrap",
    gap: 12,
  1. Update the import paths to match your project setup.
  1. Target iOS 17 or later.

  2. Copy the theme files every view uses:

swift/Theme/Theme.swift
import CoreText
import SwiftUI
import UIKit

struct RGBA: Sendable {
  let red: CGFloat
  let green: CGFloat
  let blue: CGFloat
  let alpha: CGFloat

  init(_ hex: UInt32, _ alpha: CGFloat = 1) {
    red = CGFloat((hex >> 16) & 0xFF) / 255
    green = CGFloat((hex >> 8) & 0xFF) / 255
    blue = CGFloat(hex & 0xFF) / 255
    self.alpha = alpha
  }
swift/Theme/Tokens.swift
import SwiftUI

public enum EsuissColor {
  public static let background = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x000000))
  public static let foreground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let card = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x1D1D1F))
  public static let cardForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let popover = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x1D1D1F))
  public static let popoverForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let primary = Color.adaptive(light: .init(0x0071E3), dark: .init(0x0A84FF))
  public static let primaryForeground = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0xFFFFFF))
  public static let secondary = Color.adaptive(light: .init(0x000000, 0.04), dark: .init(0xFFFFFF, 0.1))
  public static let secondaryForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let muted = Color.adaptive(light: .init(0xF5F5F7), dark: .init(0x161617))
  public static let mutedForeground = Color.adaptive(light: .init(0x6E6E73), dark: .init(0x86868B))
  public static let accent = Color.adaptive(light: .init(0x000000, 0.06), dark: .init(0xFFFFFF, 0.1))
  1. Copy the source:
swift/Components/Progress.swift
import SwiftUI

public struct BarProgressViewStyle: ProgressViewStyle {
  public init() {}

  public func makeBody(configuration: Configuration) -> some View {
    BarProgress(configuration: configuration)
  }
}

private struct BarProgress: View {
  let configuration: ProgressViewStyleConfiguration

  @Environment(\.accessibilityReduceMotion) private var reduceMotion

  var body: some View {
  1. Add the files to your app target.
  1. Apply the Compose compiler plugin, enable Compose, set compileSdk to 37 or higher and minSdk to 24 or higher, and add the dependencies:
build.gradle.kts
plugins {
    id("org.jetbrains.kotlin.plugin.compose")
}

android {
    compileSdk = 37
    defaultConfig { minSdk = 24 }
    buildFeatures { compose = true }
}

dependencies {
    implementation(platform("androidx.compose:compose-bom:2026.09.00"))
    implementation("androidx.compose.foundation:foundation")
    implementation("androidx.compose.ui:ui")
}
  1. Copy the theme files every view uses:
kotlin/theme/Theme.kt
package com.esuiss.ui.theme

import android.content.res.AssetManager
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.dropShadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.shadow.Shadow as DropShadow
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
kotlin/theme/Tokens.kt
package com.esuiss.ui.theme

import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp

@Immutable
data class Colors(
    val background: Color,
    val foreground: Color,
    val card: Color,
    val cardForeground: Color,
    val popover: Color,
    val popoverForeground: Color,
    val primary: Color,
  1. Copy the source:
kotlin/components/Progress.kt
package com.esuiss.ui.components

import androidx.compose.animation.core.Spring
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.spring
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.BasicText
  1. Update the com.esuiss.ui package names to match your project.

Usage

import * as React from "react"
import { Progress } from "@/components/ui/progress"

function ProgressDemo() {
  const [value, setValue] = React.useState(13)
  React.useEffect(() => {
    const timer = setTimeout(() => setValue(66), 500)
    return () => clearTimeout(timer)
  }, [])
  return <Progress value={value} />
}

export function ProgressExample() {
  return (
    <ProgressDemo />
  )
}
import SwiftUI

struct ProgressDelayed: View {
  @State private var value = 13.0

  var body: some View {
    ProgressView(value: value, total: 100)
      .progressViewStyle(.bar)
      .task {
        try? await Task.sleep(for: .milliseconds(500))
        value = 66
      }
  }
}
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import com.esuiss.ui.components.Progress
import kotlinx.coroutines.delay

@Composable
fun ProgressDefault() {
    var value by rememberSaveable { mutableFloatStateOf(13f) }
    LaunchedEffect(Unit) {
        delay(500)
        value = 66f
    }
    Progress(value, Modifier.fillMaxWidth())
}

Examples

With label

A bar with a caption and a live percentage value at the end of the row.

Web

Web preview

import * as React from "react"
import {
  Progress,
  ProgressLabel,
  ProgressValue,
} from "@/components/ui/progress"

export default function ProgressWithLabel() {
  const [value, setValue] = React.useState(0)
  React.useEffect(() => {
    const timer = setInterval(() => {
      setValue((current) => (current >= 100 ? 0 : current + 10))
    }, 600)
    return () => clearInterval(timer)
  }, [])
  return (
import SwiftUI

struct ProgressWithLabel: View {
  @State private var value = 0

  var body: some View {
    ProgressView(value: Double(value), total: 100) {
      Text("Uploading")
    } currentValueLabel: {
      Text(verbatim: "\(value)%")
    }
    .progressViewStyle(.bar)
    .task {
      while !Task.isCancelled {
        try? await Task.sleep(for: .milliseconds(600))
        value = value >= 100 ? 0 : value + 10
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import com.esuiss.ui.components.Progress
import kotlinx.coroutines.delay

@Composable
fun ProgressWithLabel() {
    var value by rememberSaveable { mutableFloatStateOf(0f) }
    LaunchedEffect(Unit) {
        while (true) {

Complete

A bar with value set to 100.

Web

Web preview

import { Progress } from "@/components/ui/progress"

export default function ProgressComplete() {
  return <Progress value={100} />
}
import SwiftUI

struct ProgressCompleteExample: View {
  var body: some View {
    ProgressView(value: 100, total: 100)
      .progressViewStyle(.bar)
  }
}
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.esuiss.ui.components.Progress

@Composable
fun ProgressCompleteExample() {
    Progress(100f, Modifier.fillMaxWidth())
}

Values

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

React Native
Progress values in React Native, light modeProgress values in React Native, dark mode
import { View } from "react-native"
import { Progress } from "@/components/ui/progress"

export default function ProgressValues() {
  return (
    <View className="w-full gap-4">
      <Progress value={0} />
      <Progress value={25} />
      <Progress value={50} />
      <Progress value={75} />
      <Progress value={100} indicatorClassName="bg-green-500" />
    </View>
  )
}

This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.

import SwiftUI

struct ProgressValuesExample: View {
  var body: some View {
    VStack(spacing: 16) {
      ForEach([0.0, 25, 50, 75, 100], id: \.self) { value in
        ProgressView(value: value, total: 100)
          .progressViewStyle(.bar)
      }
    }
    .frame(maxWidth: .infinity)
  }
}
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.esuiss.ui.components.Progress

@Composable
fun ProgressValues() {
    Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(16.dp)) {
        listOf(0f, 25f, 50f, 75f, 100f).forEach { Progress(it, Modifier.fillMaxWidth()) }
    }
}

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.

API Reference

Progress

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

PropTypeDefault
trackClassNamestring-
indicatorClassNamestring-

Also accepts the props of React.ComponentProps<typeof ProgressPrimitive.Root>.

Set value between min and max (0 and 100 by default). Pass null when the progress is unknown. trackClassName and indicatorClassName add classes to the track and the indicator. ProgressTrack and ProgressIndicator are also exported for custom layouts.

ProgressTrack

Background bar.

Also accepts the props of React.ComponentProps<typeof ProgressPrimitive.Track>.

ProgressIndicator

Animated fill that shows the current value.

Also accepts the props of React.ComponentProps<typeof ProgressPrimitive.Indicator>.

ProgressLabel

Caption text above the bar.

Also accepts the props of React.ComponentProps<typeof ProgressPrimitive.Label>.

ProgressValue

Formatted value text, aligned to the end.

Also accepts the props of React.ComponentProps<typeof ProgressPrimitive.Value>.

Format the value with format and locale. The value uses tabular numbers.

.progressViewStyle(.bar)

Style that creates BarProgressViewStyle.

Takes no parameters.

Progress

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

ParameterTypeDefault
valueFloat?-
modifierModifierModifier
maxFloat100f
labelString?null
showValueBooleanfalse
NextQR ScannerPreviousPopover

On this page

  1. 01Installation
  2. 02Usage
  3. 03Composition
  4. 04Examples
    • With label
    • Complete
    • Indeterminate
  5. 05Accessibility
  6. 06API Reference
    • Progress
    • ProgressTrack
    • ProgressIndicator
    • ProgressLabel
    • ProgressValue
  7. 07Installation
  8. 08Usage
  9. 09Examples
    • With label
    • Complete
    • Values
  10. 10Accessibility
  11. 11API Reference
    • Progress
    • ProgressTrack
    • ProgressIndicator
    • ProgressLabel
    • ProgressValue
    • .progressViewStyle(.bar)
    • Progress