ThinkingIndicator

Shows assistant progress with optional timing and steps, retaining a completion message when work stops.

import { ThinkingIndicator } from "@usefragments/ui";Source

Preview

<ThinkingIndicator showElapsed />

Usage

Use when

  • An assistant is working on a reply
  • An agent runs a plan of steps and you want to show where it stands

Avoid when

  • A generic wait with a known place for the result: use Loading or Skeleton
  • Determinate progress: use Progress

Implementation notes

  • One waiting pattern: the work wash and the label sheen, never dots or a pulse
  • Keep it mounted when work stops so the region can say it finished
  • Steps carry their state in a mark and in words: a ring waits, a dot works, a tick is done, a danger glyph and "Failed:" failed
  • Fold long plans behind "N of M done"

Installation

pnpm add @usefragments/ui

Import styles once from @usefragments/ui/styles. See the installation guide for framework and theme setup.

Anatomy

Import ThinkingIndicator once, then compose its parts with dot notation.

  • ThinkingIndicator.Steps
  • ThinkingIndicator.Step

Examples

Finished

The row stays and says it finished.

<ThinkingIndicator active={false} doneLabel="Thought for 12s" />

Plan

A plan under the live line, folded behind its count.

<ThinkingIndicator label="Checking the request…">
  <ThinkingIndicator.Steps label="Plan" foldable>
    <ThinkingIndicator.Step label="Read the request" status="complete" />
    <ThinkingIndicator.Step label="Scan changed files" status="pending">12 of 40 files</ThinkingIndicator.Step>
    <ThinkingIndicator.Step label="Write the summary" />
  </ThinkingIndicator.Steps>

Failed step

A failed step says so in words beside the danger glyph.

<ThinkingIndicator active={false} doneLabel="Stopped">
  <ThinkingIndicator.Steps>
    <ThinkingIndicator.Step label="Read the request" status="complete" />
    <ThinkingIndicator.Step label="Fetch the pull request" status="error" />
  </ThinkingIndicator.Steps>
</ThinkingIndicator>

API reference

Component props
Prop
Type
Default
Description
activeboolean | undefinedtrueWhether the assistant is still working; when false the row stays and shows doneLabel
childrenReact.ReactNodeNot setThinkingIndicator.Steps (label, foldable, defaultOpen) holding ThinkingIndicator.Step (label, status idle|pending|complete|error, detail children)
doneLabelReact.ReactNodeDoneWhat the row says once work stops
labelReact.ReactNodeThinking…What the assistant is doing
showElapsedboolean | undefinedfalseShow how long the work has run, outside the live region; frozen once work stops
Step.childrenReact.ReactNodeNot setOptional detail under the label (a file name, a count).
Step.labelRequiredReact.ReactNodeNot setWhat the step does.
Step.statusStepStatus | undefinedpendingidleerrorcompleteNot setWhere the step stands.
Steps.childrenRequiredReact.ReactNodeNot set—
Steps.defaultOpenboolean | undefinedNot setWhether a foldable list starts open.
Steps.foldableboolean | undefinedNot setFold the list behind an "N of M done" toggle.
Steps.labelstring | undefinedNot setWhat the list is, read with its count.

Accessibility

  • The label is a role="status" region that stays mounted; it swaps to doneLabel when work stops
  • Elapsed time sits outside the region so it is not read every second
  • The list is an ordered list named with its count; the current step is a status and reads "Now:", finished steps read "Done:"
  • The sweep and sheen stop under reduced motion; the wash stays
  • MessagesiblingShow ThinkingIndicator while the assistant reply has not started
  • ConversationListparentSits at the end of the conversation log
  • ProgressalternativeUse Progress for determinate progress

Next steps