/// Feedback
InlineLoading
An inline spinner + label that resolves to a success check or an error cross, driven by a state prop.
import { InlineLoading } from "@protocore/pds";The three states
state drives the indicator: "loading" shows a spinner, "success" a check, "error" a cross — each with its own label. The state is fully controlled by you, so it fits naturally at the end of a save or upload flow.
In a form action
Wire it next to a submit button: flip to loading on click, then to success or error when the request settles. The polite live region announces each transition to assistive tech.
When to use it
InlineLoading is for the small, in-place feedback that belongs beside the control that triggered it — a "Saving… / Saved" beside a form button, a per-row upload state, an inline validation check. It keeps the outcome next to the cause instead of firing a toast across the screen.
For a blocking, full-surface wait use LoadingOverlay; for indeterminate progress with no resolution use Spinner; for a determinate bar use ProgressBar. Keep the success and error states on screen only briefly, then return to idle or remove the component.
Usage
Do
- Place it beside the control that started the action.
- Change the `label` with the state ("Saving…" → "Saved").
- Return to `idle` (or unmount) shortly after resolving.
- Use the error state for the failure, then offer a retry.
Don't
- Leave a success check on screen indefinitely; it's a transient.
- Use it for a page-blocking wait; that's LoadingOverlay.
- Rely on the icon color alone — always pair it with a label.
Accessibility
- The root is a polite live region (`role="status"`), so state transitions are announced without stealing focus.
- The check and cross are decorative SVGs (`aria-hidden`); the meaning is carried by the text label, never by color alone.
InlineLoading props
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | |
label | ReactNode | — | The text shown beside the indicator. |
state | enum | loading | Which phase to render. |
style | CSSProperties | — |