Progress
Five progress treatments: moving stripes, a gradient, a glow, segmented blocks and an indeterminate shimmer. Each is sized and token-driven, with a value prop for the determinate ones.
Installation
The styled layer is free and installs like any other ai2 component.
Run the following command
npx shadcn@latest add @ai2/progress-styledDependencies, the @ai2/tokens theme and the component file are installed together.
Install dependencies
npm install motionCopy the source
components/ui/progress-styled.tsx"use client"
import type * as React from "react"
import { motion, useReducedMotion } from "motion/react"
import { cn } from "@/lib/utils"
/* Progress family: 5 decorative progress bars. Colour comes ONLY from tokens (alpha via color-mix). Size = the track height. value is 0-100 (Shimmer is indeterminate and takes no value). framer-motion drives the fill width and the sweeps; under reduced-motion the fill snaps into place and the sweeps stop. */
export type StyledSize = "sm" | "md" | "lg" | "xl"
const track: Record<StyledSize, string> = {
sm: "h-1",
md: "h-1.5",
lg: "h-2.5",
xl: "h-3.5",
}
const trackBase = "relative w-56 max-w-full overflow-hidden rounded-full bg-secondary"
type Props = React.ComponentProps<"div"> & { size?: StyledSize; value?: number; label?: string }
function clamp(v: number) {
return Math.max(0, Math.min(100, v))
}
/* Striped: token cizgili dolgu, cizgiler surekli kayar. */
export function StripedProgress({ className, size = "md", value = 60, label = "Progress", ...props }: Props) {
const reduce = useReducedMotion()
const v = clamp(value)
return (
<div
data-slot="styled-progress"
role="progressbar"
aria-valuenow={v}
aria-valuemin={0}
aria-valuemax={100}
aria-label={label}
className={cn(trackBase, track[size], className)}
{...props}
>
<motion.span
className="absolute inset-y-0 left-0 bg-primary [background-image:repeating-linear-gradient(45deg,color-mix(in_oklab,var(--primary-foreground)_25%,transparent)_0,color-mix(in_oklab,var(--primary-foreground)_25%,transparent)_6px,transparent_6px,transparent_12px)] [background-size:17px_100%]"
initial={reduce ? false : { width: 0 }}
animate={reduce ? { width: `${v}%` } : { width: `${v}%`, backgroundPositionX: ["0px", "17px"] }}
transition={
reduce
? undefined
: { width: { duration: 0.8, ease: "easeOut" }, backgroundPositionX: { duration: 0.6, ease: "linear", repeat: Infinity } }
}
/>
</div>
)
}
/* Gradient: cok tonlu token gradyan dolgu. */
export function GradientProgress({ className, size = "md", value = 60, label = "Progress", ...props }: Props) {
const reduce = useReducedMotion()
const v = clamp(value)
return (
<div
data-slot="styled-progress"
role="progressbar"
aria-valuenow={v}
aria-valuemin={0}
aria-valuemax={100}
aria-label={label}
className={cn(trackBase, track[size], className)}
{...props}
>
<motion.span
className="absolute inset-y-0 left-0 rounded-full [background-image:linear-gradient(90deg,var(--info),var(--brand),var(--success))]"
initial={reduce ? false : { width: 0 }}
animate={{ width: `${v}%` }}
transition={reduce ? undefined : { duration: 0.8, ease: "easeOut" }}
/>
</div>
)
}
/* Glow: token dolgu, ilerledikce isir (box-shadow). */
export function GlowProgress({ className, size = "md", value = 60, label = "Progress", ...props }: Props) {
const reduce = useReducedMotion()
const v = clamp(value)
return (
<div
data-slot="styled-progress"
role="progressbar"
aria-valuenow={v}
aria-valuemin={0}
aria-valuemax={100}
aria-label={label}
className={cn(trackBase, track[size], className)}
{...props}
>
<motion.span
className="absolute inset-y-0 left-0 rounded-full bg-info shadow-[0_0_10px_0_var(--info)]"
initial={reduce ? false : { width: 0 }}
animate={{ width: `${v}%` }}
transition={reduce ? undefined : { duration: 0.8, ease: "easeOut" }}
/>
</div>
)
}
/* Segmented: ayrik token bloklar; dolu olanlar value orant. */
export function SegmentedProgress({ className, size = "md", value = 60, label = "Progress", ...props }: Props) {
const v = clamp(value)
const total = 10
const filled = Math.round((v / 100) * total)
return (
<div
data-slot="styled-progress"
role="progressbar"
aria-valuenow={v}
aria-valuemin={0}
aria-valuemax={100}
aria-label={label}
className={cn("flex w-56 max-w-full gap-1", track[size], className)}
{...props}
>
{Array.from({ length: total }).map((_, i) => (
<span key={i} className={cn("h-full flex-1 rounded-full", i < filled ? "bg-primary" : "bg-secondary")} />
))}
</div>
)
}
/* Shimmer: belirsiz durum - token parlama iz boyunca surekli supurur. */
export function ShimmerProgress({ className, size = "md", label = "Loading", ...props }: Omit<Props, "value">) {
const reduce = useReducedMotion()
return (
<div
data-slot="styled-progress"
role="progressbar"
aria-label={label}
aria-valuemin={0}
aria-valuemax={100}
className={cn(trackBase, track[size], className)}
{...props}
>
{reduce ? (
<span className="absolute inset-y-0 left-0 w-2/5 rounded-full bg-primary" />
) : (
<motion.span
className="absolute inset-y-0 w-2/5 rounded-full bg-primary"
animate={{ left: ["-40%", "100%"] }}
transition={{ duration: 1.3, ease: "easeInOut", repeat: Infinity }}
/>
)}
</div>
)
}Manual installs skip the @ai2/tokens theme, so add the token CSS from the theming guide or the tone colors will be missing.
Variations
5 takes on the same idea. Each is its own export, and every one accepts a size prop (sm, md, lg, xl) aligned to the base Button scale.
Striped
A token fill with moving diagonal stripes.
import { StripedProgress } from "@/components/ui/progress-styled"
<StripedProgress value={60} />Gradient
A multi-token gradient fill.
import { GradientProgress } from "@/components/ui/progress-styled"
<GradientProgress value={60} />Glow
A token fill that glows as it advances.
import { GlowProgress } from "@/components/ui/progress-styled"
<GlowProgress value={60} />Segmented
Discrete token blocks fill proportionally.
import { SegmentedProgress } from "@/components/ui/progress-styled"
<SegmentedProgress value={60} />Shimmer
An indeterminate token sweep for unknown durations.
import { ShimmerProgress } from "@/components/ui/progress-styled"
<ShimmerProgress />ai2 Progress: 5 styled variations on the token system
The ai2 Progress are a set of 5 decorative button variations from the styled layer of the @ai2 design system, built around progress indication. They are free and MIT licensed, and every color comes from a semantic token, so they theme with the rest of ai2 in light and dark.
Motion runs on framer-motion: framer-motion animates the fill width, the moving stripes and the indeterminate sweep. The styled layer is opt-in, so the dependency only lands if you use it; the base components stay lean. Under reduced motion, the fill lands instantly and the stripes and sweep stop.
What is in the ai2 Progress?
5 exports in one file: Striped, Gradient, Glow, Segmented and Shimmer. Each renders a native button and takes a size prop (sm, md, lg, xl) aligned to the base Button. They are separate from the base Button on purpose: the base keeps its clean variant, tone and size axes, while the styled layer carries the effects.
You own the file. Copy the one category file and you have all 5 variations, with no runtime dependency on ai2 itself.
Why use it
- On-system by construction: Every color resolves to an ai2 semantic token, so the buttons follow your theme in light and dark with no extra work.
- Effect without the sprawl: The decorations live in a dedicated styled file, so the base Button keeps its clean, predictable API.
- Accessible and honest: Each renders a real button element, keeps a visible focus ring, and respects prefers-reduced-motion.
Features
- Token-driven color: No hardcoded hex or oklch; the look recolors with your theme tokens.
- framer-motion: framer-motion animates the fill width, the moving stripes and the indeterminate sweep.
- Reduced-motion aware: Under prefers-reduced-motion, the fill lands instantly and the stripes and sweep stop.
- Size aligned to the base: Every variation takes sm, md, lg and xl matching the base Button height scale, so styled and base buttons line up in a row.
Production tips
- Use it for emphasis, not everywhere: Styled buttons draw the eye. Reserve them for the one action you want people to take on a screen, and use the base Button for the rest.
- Keep labels as verbs: The decoration adds weight, so a clear action label keeps the button scannable.
- Pick one variation per surface: The variations share a family; using two different ones in the same view competes for attention.
Works with the rest of ai2
The Progress sit alongside the base Button and the rest of the @ai2 registry. They share the same token file, so a styled action next to a base button or a badge stays visually consistent in both modes.