Primitives
Animated Number Avatar Badge Button Button Group Toggle Toggle Group Checkbox Chip Countdown Divider Fab Grid Icon Image Input Search Input Textarea Label Loader Marquee Masked Input Message Bubble Notification Banner Offline Banner Progress Progress Ring Radio Group Range Slider Rating Separator Skeleton Slider Stack Stepper Switch Text Theme Toggle Ticker Typing IndicatorComposed
Accordion Achievement Badge Action Bar Action Sheet Action Swap Activity Rings Add to Cart Button Address Card Agenda List Alert Amount Keypad Animated Icons App Bar Audio Message Audio Recorder Autocomplete Avatar Group Balance Display Bar List Barcode Before After Biometric Gate Bloom Menu Bottom Sheet Paywall Sheet Side Sheet Breadcrumb Calendar Calendar Strip Card Carousel Cart Item Character Charts Chat Composer Chat List Item Choice Card Circle Reveal Coach Marks Collapsible Collapsible Header Color Picker Combobox Command Palette Comment Thread Confetti Consent Sheet Context Menu Copy Field Country Picker Coupon Input Currency Input Data Table Date Range Picker Day Schedule Dialog Dock Donut Chart Drawer Driver Card Dropdown Menu Drum Picker Emoji Picker Empty State Error State Event Card Expandable Control Fader Feature Gate File Picker Filter Bar Follow Button Form Gauge Glass Glass Cluster Glass Dock Morph Glass Fab Morph Glass Lab Glass Orb Glass Search Morph Glass Sheet Edge Gradient Button Headline New Heatmap Image Cropper Image Viewer Kanban Card Keyboard Avoiding Keyboard Toolbar Leaderboard Level Progress Lightbox Like Button Line Chart List Reorderable List Swipeable Row Location Card Location Search Map Sheet Map View Markdown View Media Controls Media Picker Media Tile Mention Input Meter Bar Mini Player Mood Slider Morphing Modal Multi Select Navigation Rail Notification Item Number Input Onboarding Pager Order Card Order Summary OTP Input Pagination Paper Clip New Parallax Header Pass Card Password Strength Payment Button Payment Card Payment Method Permission Primer Phone Input PIN Pad Polaroid New Poll Popover Post Card Postage Stamp New Price Tag Pricing Table Product Card Product Gallery Profile Header Promo Banner Prompt Input Property Card Pull To Refresh QR Code Quick Actions Quick Replies Rating Summary Reaction Picker Resend Timer Review Card Review Prompt Ride Option Save Button Scan Frame Scroll Spy Tabs Seat Map Section Header Section Index Segmented Control Select Share Button Share Sheet Shutter Button Signature Pad Slide to Confirm Slot Picker Smart Banner Social Login Button Sparkline Splash Screen Split Button Stat Card Stateful Button Status Dot Step Flow Steps Sticker New Stopwatch Stories Progress Stories Viewer Story Ring Streak Counter Streaming Text Success Seal Swipe Deck Tabs Tag Input Tape New Text Reveal Thinking Indicator Time Picker Timeline Timer Ring Tip Selector Toast Toolbar Tooltip Track Row Transaction Row Trip Progress Variant Picker Video Controls Waveform Weather Card Weekday Picker Zoom TransitionScreens
Account Switcher Biometric Setup Delete Account Forgot Password Grow Auth Login Login — Dark Stage Login — Dense Work Login — Editorial Login — Illustrated Login — Minimal Ink Login — Social Login — Video Loop Food Onboarding Onboarding Onboarding Dark Objects Onboarding Editorial Onboarding Illustrated Onboarding Personalize Onboarding Photo Carousel OTP Verification Passkey — Create Password Reset Permission — Notifications Phone Verification Onboarding Quiz Session Devices Signup Sign-up Chat Sign-up Photo Sheet Social Auth Split Auth Verify Identity Welcome AI Chat AI Assistant Channels List Chat Info Chat List Chat Media Chat Thread Create Group Group Info Message Requests New Message Kept Messages Accessibility Activity Log Appearance Authenticator Blocked Accounts Export Your Data Downloads Edit Profile Edit Profile — Rows Emergency Call Empty States Set Error State Send Feedback Device Locator Help Center Home — Bento Home — Dark Home — Editorial Home Feed Invite Friends Language & Region Linked Accounts Not Found (404) Notification Settings Notifications Password Vault Paywall Paywall — Comparison Paywall — Dark Stage Paywall — Editorial Paywall — Photo Paywall — Trial Timeline Privacy Profile Profile — Gamified Profile — Minimal Profile — Photo Hero QR Scanner Report Issue Saved Items Phone Time Search Search — Command Palette Search — Visual Account Health Settings Settings — Dark Device Settings — Search Storage & Data Terms & Privacy Dating Chat Dating Filters Profile Discover Its A Match Into You Matches Profile Detail Profile Editor Courier Matching Delivery History Delivery Support Package Schedule Parcel Tracking Proof Of Delivery Quick Aisle Quick Home Send Package Substitutions Add Payment Address Book Cart Categories Checkout Checkout — Steps Checkout Success Delivery Filters & Sort Flash Sale Gift Cards Loyalty Points Order Cancel Order Detail Orders Pay Later Checkout Payment Methods Product Detail Product Detail — Hero Product Grid Product Reviews Promo Codes Recently Viewed Return Items Search Results Shop Assistant Store Home Tip & Rate Courier Order Tracking Wishlist Write a Review Event Checkin Event Hero Events Discover My Tickets Seat Selection Ticket Checkout Add Card Bank Accounts Dashboard — Bento Bill Pay Budgets Card Details Crypto Portfolio Finance Dashboard Dashboard — Dark Exchange Currency Expense List Invoice Detail Manage Cards Plan Management Savings Goals Send Money Spending Analytics Split Bill Subscriptions Token Detail Token Swap Transactions Wallet Home Wallet Movers Courier Tracking Food Cart Food Home Food Orders Grocery List Recipe Detail Restaurant — Dark Restaurant Detail Activity Rings Fitness Home Habit Quest Habit Tracker Meal Planner Med Store Meditation Player Mood Check-in Nutrition Home Period Tracker Prior Auth Prior Auth Cases Quest Complete Run Tracking Rx Scan Sleep Tracker Telehealth Booking Walk Map Water Tracker Workout Complete Workout Detail Workout Session Applications Apply Company Interview Schedule Job Detail Job Feed Resume Saved Jobs Create Listing Item Chat Listing Detail Make Offer Market Checkout Market Home Market Search My Listings Offers Inbox Seller Profile Audiobook Player Camera Gallery Albums Game Store Mini Player Music Player Photo Editor Photo Gallery Playlist Detail Podcast Player Clips Feed Serene Home Sound Mixer Stories Video Call Video Player Article Reader Course Detail Event Detail Memory Onboarding Icon Lab Leaderboard Lesson Player Match Detail News Editorial News Home Plant Care Prediction Live Prediction Welcome Smart Home Standings Ticket Wallet Topics Follow Weather Detail Add Task Sheet Alarm Clock Calendar Day Calendar Month Doc Scanner File Manager Focus Timer Journal Kanban Board Mail Inbox Mail Thread Note Editor Notes List Reminders Task List Time Blocks Agent Profile Compare Homes Mortgage Calculator Property Detail Rental Application Saved Homes Schedule Tour Search List Search Map Complete Destination Driver Arriving Ev Charging History Home In Trip Matching Options Parking Receipt Safety Schedule Scooter Unlock Booking Confirmed Booking Review Booking Slots My Bookings Pro On The Way Provider Detail Provider List Rate Service Services Home Arc Create Arc Detail Arc Onboarding Avatar Creator Comments Sheet Create Post Explore Grid Followers List Hashtag Feed Mentions Post Detail Post Hero Social Profile Boarding Pass Booking Confirm Car Rental Trip Discover Flight Live Flight Preferences Flight Results Flight Search Hotel Detail Live Transit Trip — Map Day Trip — Rideshare Request Seat Select Travel Home Trip Itinerary Trip OnboardingNothing matches — try another word.
Progress Ring
Circular progress ring with a bright bead on its leading edge. Reaching 100% brightens the ring and briefly turns any centre figure into a check; an indeterminate mode laps the track.
Preview
import * as React from "react";
import { forwardRef } from "react";
import { Text, View, type ViewProps } from "react-native";
import Animated, {
useSharedValue,
useAnimatedProps,
useAnimatedStyle,
withDelay,
withSequence,
withSpring,
withTiming,
withRepeat,
cancelAnimation,
Easing,
} from "react-native-reanimated";
import Svg, { Circle, G } from "react-native-svg";
import {
cn,
ease,
spring,
tempo,
timing,
useHaptic,
useReducedMotion,
useTheme,
AnimatedCircle,
AnimatedPath,
LightPool,
type ColorTokens,
} from "@lumioui/core";
/**
* ProgressRing — circular progress whose arc head is the light source.
* <ProgressRing value={72} />
* <ProgressRing value={pct} size={188} strokeWidth={16} onClosed={…}><Text>412</Text></ProgressRing>
* <ProgressRing indeterminate label="Syncing" />
*
* The arc glides to its value with a bright point at the head. Closing the
* ring is a reward moment (act, hold, resolve): when the arc lands on 100%
* the head ignites, the track brightens, a pool of the arc's light blooms
* behind the ring and the centre figure swaps in place to a drawn check.
* The check holds, then the figure returns with a "Closed" caption and
* `onClosed` fires; the ring stays full and lit. Indeterminate is a comet —
* a short arc with a fading tail lapping the track.
* Expo Go compatible (react-native-svg only). Reduced motion snaps the arc,
* keeps the light, drops the spark and travel, and swaps the comet's lap
* for a calm opacity pulse.
*/
/** Determinate fill — same glide as linear Progress: timing.normal, ease.out. */
const FILL_MS = timing.normal.duration;
const FILL_TIMING = { duration: FILL_MS, easing: Easing.bezier(...ease.out) };
/** Comet lap — a roll and a drift (1.1s), the same cadence as the
* pull-to-refresh rotor, constant linear rotation. */
const LAP = { duration: tempo.roll + tempo.drift, easing: Easing.linear };
/** Reduced-motion stand-in for the lap — two rolls of calm breathing, no travel. */
const PULSE_CYCLE = { duration: tempo.roll * 2, easing: Easing.bezier(...ease.inOut) };
/** Length of the comet as a share of the track. It is drawn once and only
* the wrapping view rotates: animating strokeDashoffset forever would
* re-rasterise the path every frame, a rotate stays on the compositor. */
const COMET_ARC = 0.3;
/** The tail is drawn as this many steps, each brighter toward the head. */
const COMET_STEPS = 6;
/** Act, hold, resolve — the drawn check holds this long before the figure
* returns (a drift and a snap ≈ 690ms, inside the 600–800ms hold band). */
const HOLD_MS = tempo.drift + tempo.snap;
/** The check draws on in one even stroke. */
const CHECK_DRAW = { duration: timing.normal.duration, easing: Easing.bezier(...ease.out) };
const IGNITE = { ...timing.fast, easing: Easing.bezier(...ease.out) };
const DIM = { ...timing.recede, easing: Easing.bezier(...ease.in) };
/** Head-light spark when the ring closes — one small overshoot, then home. */
const HEAD_SPARK = 1.06;
/** Track alpha at rest and once the ring has closed. */
const TRACK_REST = 0.15;
const TRACK_LIT = 0.3;
/** The head's light core — present while filling, full when closed. */
const HEAD_REST = 0.6;
const HEAD_LIT = 0.95;
/** Light colour of the head core. Light, not ink: always white. */
const LIGHT = "#FFFFFF";
type Phase = "open" | "closing" | "closed";
export interface ProgressRingProps extends Omit<ViewProps, "children"> {
/** 0–100. Ignored while `indeterminate` is set. */
value?: number;
/** Square size in px. Default 96. */
size?: number;
/** Ring stroke width in px. Default 8. */
strokeWidth?: number;
/** Theme color token for the arc. Default "primary". */
color?: keyof ColorTokens;
/** Unknown progress — renders a lapping comet instead of the fill. */
indeterminate?: boolean;
/** Run the indeterminate lap. false pauses the loop (off-screen, idle). Default true. */
active?: boolean;
/** Accessible label. Default "Progress, N%" (or "Loading" when indeterminate). */
label?: string;
/** Play the close moment (light, check, hold) when the value reaches 100. Default true. */
celebrate?: boolean;
/** Caption under the centre figure once closed. null hides it. Default "Closed". */
closedLabel?: string | null;
/** Success haptic when the ring closes. Default true. */
haptics?: boolean;
/** Fires after the close has held — resolve captions and actions here. */
onClosed?: () => void;
/** Center slot — label, icon, or any content rendered inside the ring. */
children?: React.ReactNode;
className?: string;
}
export const ProgressRing = forwardRef<React.ElementRef<typeof View>, ProgressRingProps>(
function ProgressRing(
{
value = 0,
size = 96,
strokeWidth = 8,
color = "primary",
indeterminate = false,
active = true,
label,
celebrate = true,
closedLabel = "Closed",
haptics = true,
onClosed,
children,
className,
...props
},
ref
) {
const { colors } = useTheme();
const reduceMotion = useReducedMotion();
const haptic = useHaptic(haptics);
const clamped = Math.max(0, Math.min(100, value));
const arcColor = colors[color];
const full = !indeterminate && clamped >= 100;
const c = size / 2;
const radius = (size - strokeWidth) / 2;
const circumference = 2 * Math.PI * radius;
const target = indeterminate ? 0 : clamped / 100;
// Close state is resolved during render: reaching 100 starts the close,
// leaving it reopens. Mounting full shows the closed ring, no event.
const [phase, setPhase] = React.useState<Phase>(full ? "closed" : "open");
const [wasFull, setWasFull] = React.useState(full);
const [pool, setPool] = React.useState(false);
if (full !== wasFull) {
setWasFull(full);
setPhase(full ? (celebrate ? "closing" : "closed") : "open");
if (!full) setPool(false);
}
/** 0 → empty, 1 → full circle drawn. */
const fill = useSharedValue(target);
/** Rotor angle for the comet. */
const spin = useSharedValue(0);
/** Reduced-motion pulse opacity. */
const pulse = useSharedValue(1);
/** 0 → resting light, 1 → closed and lit. */
const glow = useSharedValue(full ? 1 : 0);
const head = useSharedValue(1);
const figure = useSharedValue(1);
const figureScale = useSharedValue(1);
const checkOn = useSharedValue(0);
const checkDraw = useSharedValue(0);
const latest = React.useRef({ haptic, onClosed });
latest.current = { haptic, onClosed };
React.useEffect(() => {
fill.value = reduceMotion ? target : withTiming(target, FILL_TIMING);
}, [target, fill, reduceMotion]);
// Comet lap (or its reduced-motion pulse).
React.useEffect(() => {
if (!indeterminate) {
cancelAnimation(spin);
cancelAnimation(pulse);
spin.value = 0;
pulse.value = 1;
return;
}
if (reduceMotion) {
spin.value = 0;
pulse.value = withRepeat(withTiming(0.45, PULSE_CYCLE), -1, true);
return () => cancelAnimation(pulse);
}
if (!active) {
// Paused (off-screen / idle): hold the comet where it is.
cancelAnimation(spin);
return;
}
spin.value = 0;
spin.value = withRepeat(withTiming(360, LAP), -1, false);
return () => cancelAnimation(spin);
}, [indeterminate, reduceMotion, active, spin, pulse]);
// The close: light lands with the arc, the check holds, the figure returns.
React.useEffect(() => {
if (phase !== "closing") return;
const ignite = setTimeout(() => {
latest.current.haptic.success();
setPool(true);
}, FILL_MS);
const resolve = setTimeout(() => {
setPhase("closed");
latest.current.onClosed?.();
}, FILL_MS + CHECK_DRAW.duration + HOLD_MS);
return () => {
clearTimeout(ignite);
clearTimeout(resolve);
};
}, [phase]);
React.useEffect(() => {
if (phase === "closing") {
glow.value = withDelay(FILL_MS, withTiming(1, timing.normal));
head.value = reduceMotion
? 1
: withDelay(FILL_MS, withSequence(withSpring(HEAD_SPARK, spring.pop), withSpring(1, spring.swap)));
figure.value = withDelay(FILL_MS, withTiming(0, DIM));
checkOn.value = withDelay(FILL_MS, withTiming(1, IGNITE));
checkDraw.value = 0;
checkDraw.value = reduceMotion ? 1 : withDelay(FILL_MS, withTiming(1, CHECK_DRAW));
return;
}
// Leaving the check dims it — it is never un-drawn.
const fromCheck = checkOn.value > 0;
checkOn.value = withTiming(0, DIM);
figure.value = withTiming(1, IGNITE);
if (fromCheck && !reduceMotion) {
figureScale.value = 0.96;
figureScale.value = withSpring(1, spring.swap);
}
glow.value = withTiming(phase === "closed" ? 1 : 0, timing.normal);
}, [phase, reduceMotion, glow, head, figure, figureScale, checkOn, checkDraw]);
const arcProps = useAnimatedProps(() => ({
// dasharray "arc gap" — a single arc segment whose head sweeps clockwise.
strokeDashoffset: circumference * (1 - fill.value),
}));
const trackProps = useAnimatedProps(() => ({
strokeOpacity: TRACK_REST + (TRACK_LIT - TRACK_REST) * glow.value,
}));
// Head position in the -90° rotated frame (0 = 12 o'clock).
const headHaloProps = useAnimatedProps(() => {
const a = fill.value * 2 * Math.PI;
return {
cx: c + radius * Math.cos(a),
cy: c + radius * Math.sin(a),
r: ((strokeWidth + 2) / 2) * head.value,
opacity: fill.value > 0.02 ? 1 : 0,
};
});
const headCoreProps = useAnimatedProps(() => {
const a = fill.value * 2 * Math.PI;
return {
cx: c + radius * Math.cos(a),
cy: c + radius * Math.sin(a),
r: Math.max(1, strokeWidth / 4) * head.value,
opacity: fill.value > 0.02 ? HEAD_REST + (HEAD_LIT - HEAD_REST) * glow.value : 0,
};
});
const spinStyle = useAnimatedStyle(() => ({
transform: [{ rotate: `${spin.value}deg` }],
opacity: pulse.value,
}));
const figureStyle = useAnimatedStyle(() => ({
opacity: figure.value,
transform: [{ scale: figureScale.value }],
}));
// Drawn check, centred, about a third of the ring.
const k = size * 0.32;
const x0 = c - k / 2;
const y0 = c - k / 2;
const checkD = `M${x0 + k * 0.12} ${y0 + k * 0.54} L${x0 + k * 0.4} ${y0 + k * 0.8} L${x0 + k * 0.9} ${y0 + k * 0.22}`;
const checkLen = k * (Math.hypot(0.28, 0.26) + Math.hypot(0.5, 0.58));
const checkProps = useAnimatedProps(() => ({
strokeDashoffset: checkLen * (1 - checkDraw.value),
opacity: checkOn.value,
}));
const comet = Array.from({ length: COMET_STEPS }, (_, i) => {
const seg = (circumference * COMET_ARC) / COMET_STEPS;
const isHead = i === COMET_STEPS - 1;
return (
<Circle
key={i}
cx={c}
cy={c}
r={radius}
stroke={arcColor}
strokeOpacity={(i + 1) / COMET_STEPS}
strokeWidth={strokeWidth}
strokeLinecap={isHead ? "round" : "butt"}
fill="none"
strokeDasharray={`${isHead ? seg * 0.6 : seg + 0.5} ${circumference}`}
strokeDashoffset={-seg * i}
/>
);
});
const showCaption = phase === "closed" && closedLabel != null && closedLabel !== "";
const poolSize = size * 1.7;
const baseLabel = label ?? (indeterminate ? "Loading" : `Progress, ${Math.round(clamped)} percent`);
return (
<View
ref={ref}
className={cn("items-center justify-center", className)}
style={{ width: size, height: size }}
accessibilityRole="progressbar"
accessibilityLabel={showCaption ? `${baseLabel}, ${closedLabel}` : baseLabel}
accessibilityValue={indeterminate ? undefined : { min: 0, max: 100, now: Math.round(clamped) }}
accessibilityState={indeterminate ? { busy: true } : undefined}
// accessibilityValue/accessibilityState aren't forwarded to the DOM
// on web — mirror them with explicit aria-* like Slider does.
aria-valuemin={indeterminate ? undefined : 0}
aria-valuemax={indeterminate ? undefined : 100}
aria-valuenow={indeterminate ? undefined : Math.round(clamped)}
aria-busy={indeterminate ? true : undefined}
{...props}
>
<LightPool
on={pool && full}
color={arcColor}
size={poolSize}
className="absolute"
style={{ left: (size - poolSize) / 2, top: (size - poolSize) / 2 }}
/>
<Animated.View style={spinStyle}>
<Svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>
{/* -90° about the center puts the arc start at 12 o'clock —
* applied on <G> rather than the <Svg> style transform, which
* some react-native-svg versions ignore on the root element. */}
<G transform={`rotate(-90 ${c} ${c})`}>
<AnimatedCircle
cx={c}
cy={c}
r={radius}
stroke={arcColor}
strokeWidth={strokeWidth}
fill="none"
animatedProps={trackProps}
/>
{indeterminate ? (
comet
) : (
<>
<AnimatedCircle
cx={c}
cy={c}
r={radius}
stroke={arcColor}
strokeWidth={strokeWidth}
strokeLinecap="round"
fill="none"
strokeDasharray={`${circumference} ${circumference}`}
animatedProps={arcProps}
/>
{/* The head is the light source: a slightly proud cap with a white core. */}
<AnimatedCircle fill={arcColor} animatedProps={headHaloProps} />
<AnimatedCircle fill={LIGHT} animatedProps={headCoreProps} />
</>
)}
</G>
</Svg>
</Animated.View>
{children ? (
<>
<Animated.View
pointerEvents="none"
className="absolute inset-0 items-center justify-center"
style={figureStyle}
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
>
{children}
{showCaption ? (
<Text
className={cn("mt-1 text-sm font-semibold", color === "primary" && "text-primary-text")}
style={color === "primary" ? undefined : { color: arcColor }}
>
{closedLabel}
</Text>
) : null}
</Animated.View>
<Svg
pointerEvents="none"
width={size}
height={size}
style={{ position: "absolute", left: 0, top: 0 }}
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
>
<AnimatedPath
d={checkD}
stroke={arcColor}
strokeWidth={Math.max(3, size * 0.045)}
strokeLinecap="round"
strokeLinejoin="round"
fill="none"
strokeDasharray={`${checkLen} ${checkLen}`}
animatedProps={checkProps}
/>
</Svg>
</>
) : null}
</View>
);
}
);
ProgressRing.displayName = "ProgressRing"; import { ProgressRing } from "@/components/ui/progress-ring/progress-ring";
export function Example() {
return (
<ProgressRing />
);
} Installation
Install the dependencies
npx expo install react-native-reanimated react-native-svgCopy the source from the Code tab into your project
components/ui/progress-ring/progress-ring.tsxcomponents/ui/progress-ring/index.tsUpdate the import paths to match your project setup.
Usage
import { ProgressRing } from "@/components/ui/progress-ring/progress-ring"; <ProgressRing /> Examples
Pairing a smart speaker.
import * as React from "react";
import { View } from "react-native";
import { ProgressRing } from "../progress-ring";
import { Button } from "../../button/button";
import { Icon } from "../../icon/icon";
import { Text } from "../../text/text";
type Phase = "searching" | "pairing" | "done";
/** ProgressRingIndeterminate — pairing a smart speaker. A comet laps the
* ring while the device is being found, then hands over to a real fill as
* the setup steps complete. The last step closes the ring: the speaker
* glyph dims while a check draws and holds, then the glyph returns as a
* check and the copy resolves to "ready". */
export function ProgressRingIndeterminate() {
const [phase, setPhase] = React.useState<Phase>("searching");
const [pct, setPct] = React.useState(0);
React.useEffect(() => {
if (phase === "searching") {
const t = setTimeout(() => setPhase("pairing"), 2400);
return () => clearTimeout(t);
}
if (phase === "pairing") {
if (pct >= 100) return;
const t = setTimeout(() => setPct((p) => Math.min(100, p + 20)), 450);
return () => clearTimeout(t);
}
}, [phase, pct]);
const restart = () => {
setPct(0);
setPhase("searching");
};
const title = phase === "searching" ? "Looking for your speaker" : phase === "pairing" ? "Connecting to Wi-Fi" : "Kitchen speaker is ready";
const body =
phase === "searching"
? "Keep your phone within a metre of the speaker."
: phase === "pairing"
? "Sending the password for Brennan Home."
: "Say \"Play some jazz\" to try it out.";
return (
<View className="w-full items-center gap-8 rounded-3xl bg-card px-5 pb-5 pt-10">
<ProgressRing
size={148}
strokeWidth={6}
indeterminate={phase === "searching"}
value={phase === "done" ? 100 : pct}
label={title}
closedLabel={null}
onClosed={() => setPhase("done")}
>
<View className="h-20 w-20 items-center justify-center rounded-full bg-secondary">
<Icon name={phase === "done" ? "check" : "volume-2"} size="xl" color="foreground" />
</View>
</ProgressRing>
<View className="items-center gap-2">
<Text className="text-center text-2xl font-bold tracking-tight">{title}</Text>
<Text className="text-center text-base text-muted-foreground">{body}</Text>
</View>
<Button
size="lg"
variant={phase === "done" ? "default" : "secondary"}
className="w-full"
onPress={restart}
>
{phase === "done" ? "Done" : "Cancel"}
</Button>
</View>
);
} The daily energy ring in a fitness app.
import * as React from "react";
import { View } from "react-native";
import { Accent } from "@lumioui/core";
import { ProgressRing } from "../progress-ring";
import { Button } from "../../button/button";
import { Text } from "../../text/text";
const GOAL = 620;
/** ProgressRingLabeled — the daily energy ring in a fitness app. The number
* inside is the hero; logging a workout glides the arc forward with a lit
* head. The workout that closes the ring blooms its light, draws a check
* over the figure and holds it before the figure returns marked "Closed"
* and the button resolves. */
export function ProgressRingLabeled() {
const [kcal, setKcal] = React.useState(412);
const pct = Math.min(100, (kcal / GOAL) * 100);
const closed = kcal >= GOAL;
/** The close has played and held — the button may move on. */
const [resolved, setResolved] = React.useState(false);
return (
<Accent color="red" className="w-full">
<View className="w-full gap-6 rounded-3xl bg-card p-5">
<View className="flex-row items-center justify-between">
<Text className="text-[17px] font-semibold">Energy</Text>
<Text variant="muted">Tuesday</Text>
</View>
<View className="items-center">
<ProgressRing value={pct} size={188} strokeWidth={16} label={`Energy, ${kcal} of ${GOAL} calories`} onClosed={() => setResolved(true)}>
<Text className="text-5xl font-semibold tracking-tight tabular-nums">{kcal}</Text>
<Text variant="muted" className="tabular-nums">of {GOAL} kcal</Text>
</ProgressRing>
</View>
<View className="overflow-hidden rounded-2xl bg-secondary">
{[
["Active", "38 of 45 min"],
["Distance", "6.2 km"],
["Steps", "8,214"],
].map(([label, val], i) => (
<View key={label} className={`flex-row items-center justify-between px-4 py-3 ${i > 0 ? "border-t border-border" : ""}`}>
<Text className="text-[15px]">{label}</Text>
<Text className="text-[15px] font-medium tabular-nums text-muted-foreground">{val}</Text>
</View>
))}
</View>
<Button
size="lg"
className="w-full"
disabled={closed && !resolved}
onPress={() => {
if (closed) {
setResolved(false);
setKcal(412);
return;
}
setKcal((k) => Math.min(GOAL, k + 70));
}}
>
{closed && resolved ? "Ring closed. Start over" : "Log 20 min cycling"}
</Button>
</View>
</Accent>
);
} API reference
value number 0–100. Ignored while indeterminate is set.
0 size number Square size in px. Default 96.
96 strokeWidth number Ring stroke width in px. Default 8.
8 color keyof ColorTokens Theme color token for the arc. Default "primary".
"primary" indeterminate boolean Unknown progress — renders a lapping comet instead of the fill.
false active boolean Run the indeterminate lap. false pauses the loop (off-screen, idle). Default true.
true label string Accessible label. Default "Progress, N%" (or "Loading" when indeterminate).
—celebrate boolean Play the close moment (light, check, hold) when the value reaches 100. Default true.
true closedLabel string | null Caption under the centre figure once closed. null hides it. Default "Closed".
"Closed" haptics boolean Success haptic when the ring closes. Default true.
true onClosed () => void Fires after the close has held — resolve captions and actions here.
—children React.ReactNode Center slot — label, icon, or any content rendered inside the ring.
—className string —