Progress
Determinate progress bars with outline and subtle tracks in five sizes.
1234567891011121314151617import { Progress } from "#components/ui/ui-sdk/progress.tsx";import { indigoPalette } from "@stylexblocks/ui/themes/palettes.ts";
export function Example() { return ( // UI SDK's Progress parts wearing the recipe styles — they carry value // state and aria; variant/size/shape resolve once on Root and // Track/Range (UI SDK's Indicator) inherit them via context <Progress.Root value={64} variant="subtle" size="md" shape="full" palette={indigoPalette}> <Progress.Label>Upload</Progress.Label> <Progress.Track> <Progress.Range striped /> </Progress.Track> <Progress.ValueText /> </Progress.Root> );}Variants
Sizes
Install
1npx stylexblocks add progressSource
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224import { Progress as UiSdkProgress, ProgressIndicator as UiSdkProgressIndicator, ProgressLabel as UiSdkProgressLabel, ProgressTrack as UiSdkProgressTrack, ProgressValue as UiSdkProgressValue,} from "@ui-sdk/react/progress";import { createSlotRecipeContext } from "#lib/ui-sdk/create-slot-recipe-context.tsx";import { defineSlotRecipe, resolveSlotStyles, type SlotRecipeVariants, type WithStyleOverrides,} from "#lib/recipe-props.ts";import * as stylex from "@stylexjs/stylex";import { colorPalette } from '@stylexblocks/ui/color-palette.stylex.ts'import { durations } from '@stylexblocks/ui/tokens/durations.stylex.ts'import { fontSizes } from '@stylexblocks/ui/tokens/font-sizes.stylex.ts'import { fontWeights } from '@stylexblocks/ui/tokens/font-weights.stylex.ts'import { lineHeights } from '@stylexblocks/ui/tokens/line-heights.stylex.ts'import { radii } from '@stylexblocks/ui/tokens/radii.stylex.ts'import { semanticColors } from '@stylexblocks/ui/semantic-tokens/colors.stylex.ts'import { semanticRadii } from '@stylexblocks/ui/semantic-tokens/radii.stylex.ts'import { semanticShadows } from '@stylexblocks/ui/semantic-tokens/shadows.stylex.ts'import { sizes } from '@stylexblocks/ui/tokens/sizes.stylex.ts'
const progressRoot = stylex.create({ base: { fontSize: fontSizes.sm, lineHeight: lineHeights.sm, position: 'relative', },})
const progressTrack = stylex.create({ base: { overflow: 'hidden', position: 'relative', },})
const progressTrackSizes = stylex.create({ xs: { height: sizes._1_5, }, sm: { height: sizes._2, }, md: { height: sizes._2_5, }, lg: { height: sizes._3, }, xl: { height: sizes._4, },})
const progressTrackVariants = stylex.create({ outline: { boxShadow: semanticShadows.inset, backgroundColor: semanticColors.bgSubtle, }, subtle: { backgroundColor: colorPalette.muted, },})
const progressTrackShapes = stylex.create({ rounded: { borderRadius: semanticRadii.control, }, full: { borderRadius: radii.full, },})
const progressRange = stylex.create({ base: { display: 'flex', alignItems: 'center', justifyContent: 'center', transitionProperty: 'width, height', transitionDuration: durations.slow, height: '100%', backgroundColor: 'var(--track-color)', },})
const progressRangeVariants = stylex.create({ outline: { backgroundColor: colorPalette.solid, }, subtle: { backgroundColor: `color-mix(in oklch, ${colorPalette.solid} 72%, transparent)`, },})
const progressRangeStripeds = stylex.create({ true: { backgroundImage: 'linear-gradient(45deg, var(--stripe-color) 25%, transparent 25%, transparent 50%, var(--stripe-color) 50%, var(--stripe-color) 75%, transparent 75%, transparent)', backgroundSize: 'var(--stripe-size) var(--stripe-size)', '--stripe-size': '1rem', '--stripe-color': 'rgba(255, 255, 255, 0.3)', },})
const progressRangeAnimateds = stylex.create({ true: { '--animate-from': 'var(--stripe-size)', animationName: 'bg-position', animationDuration: '1s', animationTimingFunction: 'linear', animationIterationCount: 'infinite', },})
const progressLabel = stylex.create({ base: { display: 'inline-flex', fontWeight: fontWeights.medium, },})
const progressValueText = stylex.create({ base: { fontSize: fontSizes.xs, lineHeight: 1, fontWeight: fontWeights.medium, },})
export type ProgressVariant = keyof typeof progressTrackVariants
export type ProgressShape = keyof typeof progressTrackShapes
export type ProgressStriped = keyof typeof progressRangeStripeds
export type ProgressAnimated = keyof typeof progressRangeAnimateds
export type ProgressSize = keyof typeof progressTrackSizes
const progressSlotRecipe = defineSlotRecipe({ slots: { root: { styles: progressRoot }, track: { styles: progressTrack, sizes: progressTrackSizes, variants: progressTrackVariants, shapes: progressTrackShapes, }, range: { styles: progressRange, variants: progressRangeVariants, }, label: { styles: progressLabel }, valueText: { styles: progressValueText }, }, defaultVariants: { variant: "outline", size: "md", shape: "rounded" },});
const { withProvider, withContext } = createSlotRecipeContext(progressSlotRecipe);
type ProgressVariants = SlotRecipeVariants<typeof progressSlotRecipe>;
/** * Progress — UI SDK's Progress parts wearing the recipe styles. * `<Progress.Root variant size shape>` resolves the recipe once and shares * it with Track/Range through context; the parts carry value state and * aria semantics (`value`, `min`, `max`). The Range (UI SDK's Indicator * part) takes boolean `striped`/`animated` props layering the recipe's * stripe maps, and every part still composes via `render`. */export type ProgressRootProps = WithStyleOverrides< React.ComponentProps<typeof UiSdkProgress>> & Partial<ProgressVariants>;
const ProgressRoot = withProvider(UiSdkProgress, "root", "ProgressRoot");
function Root(props: ProgressRootProps) { return <ProgressRoot {...(props as React.ComponentProps<typeof ProgressRoot>)} />;}Root.displayName = "ProgressRoot";
export type ProgressRangeProps = WithStyleOverrides< React.ComponentProps<typeof UiSdkProgressIndicator>> & { /** Diagonal stripe pattern from the recipe. */ striped?: boolean; /** Animates the stripes (pair with `striped`). */ animated?: boolean;};
const StyledRange = withContext( UiSdkProgressIndicator, (v) => resolveSlotStyles(progressSlotRecipe.slots.range, v), "ProgressRange",);
function Range({ striped, animated, style, ...rest }: ProgressRangeProps) { return ( <StyledRange {...rest} style={[ striped && progressRangeStripeds.true, animated && progressRangeAnimateds.true, style, ]} /> );}Range.displayName = "ProgressRange";
export const Progress = { Root, Label: withContext(UiSdkProgressLabel, "label", "ProgressLabel"), Track: withContext(UiSdkProgressTrack, "track", "ProgressTrack"), Range, ValueText: withContext(UiSdkProgressValue, "valueText", "ProgressValueText"),};
Examples
Installable blocks built with Progress — real use cases, delivered as source you own.
Three-band analytics screen: a multi-series active-sessions chart and KPI sparkline tiles, audience stacked bar cards, and supporting top-routes and top-interactions activity tables.
Heterogeneous infrastructure spend and usage ledger organized into three collapsible schema-specific table cards (Compute & Inference Clusters, Storage & Data Lakes, Third-Party Integrations & APIs) with a shared global time-range selector, cross-section search, expand/collapse-all controls, per-section column sorting, and expandable rows revealing a TanStack Charts run-rate trajectory.
Transposed side-by-side vector database evaluation matrix with a sticky criteria label column, collapsible grouped rows, interactive column swapping and adding/removing, baseline pinning with relative deltas, best-in-row highlights, differences-only filtering, score bars, 30-day uptime telemetry, and a live recommendation footer.
Interactive course overview page featuring breadcrumb navigation, tabbed Syllabus, Outcomes, Instructor, and Reviews views, a checkable 4-module curriculum accordion synced to live progress bars, and a sticky enrollment rail with a photographic course cover, self-paced vs. cohort planning, and toast feedback.
Edge runtime A/B benchmark comparison dashboard (v3.2 Candidate vs. v3.1 Baseline) with environment and metric controls, dual-series KPI sparkline cards, synchronized overlay and workload bar charts, distribution breakdowns, and a regional statistical-significance table.
Sequential technical quickstart guide featuring breadcrumb navigation, an AI setup prompt card, prerequisites and troubleshooting callouts, synced package-manager and runtime code switchers, checkable step completion progress, onward reading cards, and a responsive sticky table-of-contents rail.
Executive scorecard with a Q1–Q4 period switcher, KPI sparkline tiles, interactive ARR vs. plan TanStack Charts, segment mix and net-new ARR breakdowns, regional quota attainment table, strategic objectives tracker, and a narrative highlights rail.
Cloud workspace file manager with a collapsible folder tree, breadcrumb trail, live search, list / grid / Miller-column view switcher, row actions menu, and a synchronized metadata inspector.
Single-column accordion-style inline wizard for custom domain and TLS provisioning, featuring compact summary rows with inline Edit/Re-run actions, downstream stale invalidation, a self-running nested DNS preflight check stepper with mismatch simulation and retry recovery, and live cutover activation.
Five-step enterprise SSO and workspace provisioning wizard with a persistent vertical stepper rail, live per-step statuses and summary subtitles, overall progress indicator, draft save tracking, conditional protocol and SIEM fields, broken-step validation flagging, container-responsive top bar collapse, and grouped review and confirmation screens.
Commerce order detail page with breadcrumb navigation, fulfillment and payment status badges, itemized line-item table with product photo thumbnails, invoice breakdown, live shipment tracking timeline, customer and shipping sidebar cards with collapsible risk analysis, cancel-order confirmation dialog, and toast feedback.
Treasury and infrastructure budget portfolio view with a period switcher, KPI summary tiles, historical reserve value curve, interactive allocation slices, stacked breakdown and budget-vs-actual bars, rate benchmark sparklines, and a filterable, sortable cost-center table.
Two-column storefront product detail layout pairing a multi-angle interactive photo gallery with a sticky buy box, live anodized finish swatches, color-temperature edition controls, quantity stepper, collapsible specifications accordion, and filterable customer reviews.
Launch-readiness program tracker powered by TanStack Charts: release KPI sparklines, phase-filtered milestone Gantt with a Today marker, burndown vs. planned trajectory, sprint velocity, weighted scope allocation, blockers & risks callouts, and a health-filterable workstream progress table.
Two-pane desktop preferences modal with a categorized navigation rail, keyboard-navigable live settings search, responsive container-query collapse, accent swatch and scale controls, connected app toggles, shortcut bindings, quota progress meters, and a docked dirty-state save bar.
Multi-section workspace settings layout with grouped sidebar navigation, responsive mobile tabs, a sticky dirty-state save bar, API token management, session controls, and team billing quotas.
Application shell pairing a top navigation bar (workspace switcher, command search dialog, notifications popover, account menu) with a collapsible left sidebar, mobile slide-over drawer, and interactive cloud deployment views.
Left-rail application shell pairing a full-height collapsible sidebar (workspace switcher, quick actions, grouped route navigation, collapsible pinned collections with row menus, and user footer menu) with a mobile drawer fallback and interactive creative workspace views.
Top-navigation application shell with a centered horizontal Navbar (brand mark, route links, ⌘K command search dialog, notifications popover, account menu), mobile slide-over drawer fallback, and interactive public & internal operations views.
Interactive design-system and token workbench featuring scoped accent, density, and corner-radius live preview controls over a responsive 3-column bento of cohesive UI SDK cards.
Hierarchical work breakdown and cost rollup tree table with multi-level expand/collapse, visual tree guide lines, live parent rollups, hierarchical indeterminate selection, ancestor-preserving search and health filters, in-place sibling sorting, keyboard treegrid navigation, a floating bulk ActionBar, and a node inspector Drawer.
Engineering work item detail workspace with breadcrumb navigation, editable status, priority, assignee, and sprint properties rail, interactive sub-task checklist with live progress bar, linked pull requests and commits tabs, and a filterable activity timeline with comment composer.
