YuhuanStudioYunUIDocs
AI

Thinking Block

A host-fed, collapsible reasoning panel with optional task steps and pending/running/completed/failed/cancelled statuses.

A host-fed panel for a reasoning trace and optional steps. It can render partial plain text or Markdown, show per-step pending/running/done/failed/cancelled status, and select a host-owned step. ThinkingBlock does not advance a run; the host provides all content, step status, selection callbacks and streaming state.

Import

tsx1 line
import { ThinkingBlock } from "@yuhuanowo/yunui/ai";

Basic

Basic

The user is asking for the capital of France. That is Paris. I'll answer directly and concisely.

Streaming

While isStreaming is true, the compact disclosure headline uses the existing text-shimmer motion and a small activity indicator. Explicit labels.title remains the headline; the host supplies all progress.

Streaming

Let me work through the steps one by one

Host-supplied steps

When steps is non-empty, the panel shows the host's ThinkingBlockStep[] instead of the plain-text body. Each step has a stable id, label, optional detail/meta, optional monospace style, and a pending, running, done, failed, or cancelled status. selectedStepId and onStepSelect opt into a host-controlled selection; without the callback, rows stay read-only.

Host-supplied steps

  1. The host supplied this fixture step.
  2. Check the public component contracts before answering.
  3. Waiting for the host to finish the preceding step.

Host-selected step: read

open is the controlled disclosure state; pair it with onOpenChange. Without open, defaultOpen keeps the existing uncontrolled disclosure behavior. If open is supplied without onOpenChange, the trigger is read-only.

Use labels to localize the title and pending/running/completed/failed/cancelled status names.

Props

PropTypeDefaultDescription
content*string—
defaultOpenbooleanfalse
isStreamingbooleanfalse
labelsThinkingBlockLabels—
onOpenChange((open: boolean) => void)—
onStepSelect((id: string) => void)—
openboolean—Controlled disclosure state. Without `onOpenChange`, the trigger is read-only.
renderContent((content: string) => ReactNode)—Render reasoning text (e.g. with a Markdown renderer). Defaults to plain pre-wrapped text.
selectedStepIdstring—
stepsreadonly ThinkingBlockStep[][]Host-supplied detail rows (Steps / Search / Coding / Reasoning).

On this page