How to use
Loader is a small, self-contained spinner for indeterminate progress — a request in flight, a section still fetching data, a button mid-submit. It ships with 7 distinct built-in variants rather than one generic spinner, so you can pick whichever visual weight fits the surface it's sitting on.
import { Loader } from "oks-ui";All 7 variants (ring-inset, ring-clip, ring-outset, ring-dual, pulse, dots-roll, dots-sweep) are real, distinct animations, not palette swaps of the same shape — ring-inset (the default) reads as a standard spinner; the dots variants read lighter and work well inline next to text; pulse is the least visually busy option for a subtle "something's happening" indicator.
<Loader variant="ring-inset" />
<Loader variant="dots-roll" size="sm" />
<Loader variant="pulse" color="primary" />color is a shorthand that sets both the track and the moving indicator to the same color in one step — the common case. For a variant where the track and indicator should differ (a light track with a colored indicator, for instance), set trackColor and indicatorColor independently instead of using color.
<Loader color="primary" />
// Independent track/indicator colors
<Loader trackColor="default" indicatorColor="success" />size accepts the usual xs–xl token scale, or a raw pixel number when you need an exact footprint that doesn't map to a token (say, matching an icon's exact size next to it). speed takes any valid CSS time value if the default 1s animation cycle feels off for the context — slower for a background sync, faster for something the user is actively waiting on.
<Loader size="sm" />
<Loader size={18} />
<Loader speed="0.6s" />For a loading button, you almost never render Loader directly — pass isLoading to Button and it renders its own internal spinner (with spinnerPlacement/spinner to customize it) already wired to aria-busy. Reach for a standalone Loader when the loading state belongs to a section of the page, not a specific button.
// A loading section, not a button -- standalone Loader
<div className="flex items-center justify-center p-10">
<Loader label="Loading dashboard" />
</div>All available props for Loader. See the full component page for an interactive playground.
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | "Loading" | Accessible label (used with role="status"). |
label
string
Default: "Loading"
Accessible label (used with role="status").
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "ring-inset" | "ring-clip" | "ring-outset" | "ring-dual" | "pulse" | "dots-roll" | "dots-sweep" | ring-inset | Visual spinner style. |
size | "xs" | "xs-sm" | "sm" | "md" | "lg" | "xl" | number | "md" (40px) | Loader size; accepts a size token or a raw pixel number. |
color | "default" | "primary" | "secondary" | "info" | "success" | "warning" | "danger" | "white" | — | Shorthand that sets both trackColor and indicatorColor. |
trackColor | LoaderColor | color ?? "white" | Color of the loader's background track. |
indicatorColor | LoaderColor | color ?? "default" | Color of the loader's moving indicator. |
variant
"ring-inset" | "ring-clip" | "ring-outset" | "ring-dual" | "pulse" | "dots-roll" | "dots-sweep"
Default: ring-inset
Visual spinner style.
size
"xs" | "xs-sm" | "sm" | "md" | "lg" | "xl" | number
Default: "md" (40px)
Loader size; accepts a size token or a raw pixel number.
color
"default" | "primary" | "secondary" | "info" | "success" | "warning" | "danger" | "white"
Default: —
Shorthand that sets both trackColor and indicatorColor.
trackColor
LoaderColor
Default: color ?? "white"
Color of the loader's background track.
indicatorColor
LoaderColor
Default: color ?? "default"
Color of the loader's moving indicator.
| Prop | Type | Default | Description |
|---|---|---|---|
speed | string | "1s" | Animation duration, any valid CSS time value. |
speed
string
Default: "1s"
Animation duration, any valid CSS time value.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Class applied to the root element. |
style | CSSProperties | — | Inline styles for the root element. |
className
string
Default: —
Class applied to the root element.
style
CSSProperties
Default: —
Inline styles for the root element.