Skip to content
Back

Reasoning block

The thinking of a reply: a shimmering label counts seconds while the newest lines stream, then it folds to “Thought for 7s” and opens to the steps.

oxyn add reasoning-block
MCP
Thinking
Dioxus
rsx! {
    ReasoningBlock {
        reasoning: thoughts,
        status: "thinking",
        seconds: Some(7),
        on_stop: move |_| run.abort(),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • Reasoning models think before they answer — seconds to minutes.
  • Users want two opposite things from that time: proof it is working and roughly on what ("Thinking 8s · Checking the auth flow"), and not to read it once the answer arrives.
  • The converged pattern is a block that auto-opens while streaming and collapses to "Thought for Ns" when the answer starts; Warp streams a "Thinking…" header that collapses to "Thought for…"; Roo ticks a live seconds counter on its reasoning block; Cline expands its body into a 150 px scrolling area; Claude desktop offers a three-level transcript density switch Normal / Thinking / Verbose (all note 03 / 08).
  • Agent runs add complications chat kits skip: reasoning resumes between tool calls, providers may send summaries instead of raw thought, or redacted / encrypted reasoning that must never be shown, and auto-collapse must not yank text out from under someone reading it.

When not to use

  • The verb that says what the agent is doing, rotating through a verb pack while it works and settling into the past tense when it finishes: use Verb cycler instead.
  • How long the agent has worked, without the time it spent waiting for you: use Elapsed timer instead.
  • A label with light passing over it while the agent works: use Text shimmer instead.

Installation

Reasoning block is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add reasoning-block
Rust
use crate::oxyn::{ReasoningBlock, STATUS_INDICATOR_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{ReasoningBlock, STATUS_INDICATOR_CSS};

Usage

Dioxus · rust
rsx! {
    ReasoningBlock {
        reasoning: thoughts,
        status: "thinking",
        seconds: Some(7),
        on_stop: move |_| run.abort(),
    }
}

Examples

Thinking

Shimmering label, seconds and the latest lines.

Thinking
Code
rsx! {
    ReasoningBlock {
        reasoning: thoughts,
        status: "thinking",
        seconds: Some(7),
        on_stop: move |_| run.abort(),
    }
}

Done

Folded to “Thought for 7s”.

Thought for 7 seconds
Code
rsx! {
    ReasoningBlock {
        reasoning: thoughts,
        seconds: Some(7),
        on_stop: move |_| run.abort(),
    }
}

Open

Open: steps parsed from headings.

Reading the failing test

auth_refresh fails about one run in twenty, always when the token is minted at second 59.

Checking the validator

The expiry check is a strict less-than against now(), with no leeway for skew between minting and checking.

Considering fixes

A leeway of 30 seconds matches RFC 9068 guidance. Freezing the clock in the test makes the failure reproducible.

Plan

Patch token.rs, add a regression test, rerun three times.

Done · 7s
Thought for 7 seconds
Code
rsx! {
    ReasoningBlock {
        reasoning: thoughts,
        seconds: Some(7),
        on_stop: move |_| run.abort(),
    }
}

Error

Interrupted with Retry.

Reading the failing test

auth_refresh fails about one run in twenty, always when the token is minted at second 59.

Checking the validator

The expiry check is a strict less-than against now(), with no leeway for skew between minting and checking.

Considering fixes

A leeway of 30 seconds matches RFC 9068 guidance. Freezing the clock in the test makes the failure reproducible.

Plan

Patch token.rs, add a regression test, rerun three times.

Rate limited by the provider after 3 retries.
Thinking interrupted
Code
rsx! {
    ReasoningBlock {
        reasoning: thoughts,
        status: "error",
        seconds: Some(7),
        on_stop: move |_| run.abort(),
    }
}

Verbose

Verbose display level stays open (Oxyn plus).

Reading the failing test

auth_refresh fails about one run in twenty, always when the token is minted at second 59.

Checking the validator

The expiry check is a strict less-than against now(), with no leeway for skew between minting and checking.

Considering fixes

A leeway of 30 seconds matches RFC 9068 guidance. Freezing the clock in the test makes the failure reproducible.

Plan

Patch token.rs, add a regression test, rerun three times.

Done · 7s
Thought for 7 seconds
Code
rsx! {
    ReasoningBlock {
        reasoning: thoughts,
        seconds: Some(7),
        level: "verbose",
        on_stop: move |_| run.abort(),
    }
}

API reference

ReasoningBlock

PropTypeDefaultDescription
reasoningrequiredString—Full reasoning (revealed over `elapsed_ms` while thinking).
statusString"done"`thinking` · `done` · `stopped` · `error`.
secondsOption<u64>Default::default()Seconds spent (done); measured from `elapsed_ms` while thinking.
elapsed_msu64Default::default()Milliseconds since thinking started.
cpsf3260.0Characters per second while thinking.
modelString"Atlas"Model name.
variantString"card"`card` · `plain`.
levelString"normal"`normal` · `thinking` · `verbose`.
openboolDefault::default()Start open.
errorOption<String>Default::default()Error reason.
on_stopEventHandler<()>—Stop pressed.
on_retryEventHandler<()>—Retry pressed.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
EnterorSpaceOpen or close the reasoning
TabHeader, Stop / Retry, Copy reasoning

Accessibility

  • The header is a button with aria-expanded and the visible label as its name.
  • A polite region announces status changes only, never each chunk or second.
  • The live preview is aria-hidden; the full region is aria-busy while streaming.
From the spec
  • Header is a disclosure button (aria-expanded, aria-controls → body region). Accessible name by state: "Thinking, 8 seconds" (live) / "Thought for 12 seconds, summary, collapsed" / "Thought for 12 seconds, reasoning hidden by the provider".
  • Body: role="region" labelled "Reasoning"; while live aria-busy="true"; never aria-live — reasoning is not read aloud as it streams.
  • Announcements (composer polite live region): "Thinking" when the block appears (only if no other status announcement in the last 10 s), "Thought for 12 seconds" once at the roll (throttled with the status-text rules); level switch: "Reasoning display: Verbose".
  • Auto-collapse never moves focus. If focus is inside the body when a collapse would happen, the reader guard defers it; if the user collapses manually, focus returns to the header.
  • Contrast: body text uses text.secondary ≥ 4.5:1; the live fade mask covers only already-read lines and never sits over the newest line; the 🔒 and "Summary" chips carry text labels.
  • Reduced motion: §5 last row; the live timer is the liveness cue.
  • Keyboard: Tab reaches the header; Enter/Space toggles; inside the body, arrow keys scroll the live window; Ctrl+O level cycle is announced and remappable.

Motion & interaction

  • Appear (Pending → Live): header fades + rises 4 px (180 ms, dur.row.enter); in Thinking level the body window opens 0 → first line height, then grows with content up to 160 px.
  • Header while live: verb shimmer (text-shimmer/calm, status-text family timings), timer ticks at 1 Hz with digit roll; chevron ▾ static (no idle motion).
  • Body window: text reveals with the message's reveal effect (word-level fade-token by default; terminal line-commit); auto-follows the tail inside the window; 24 px top fade mask; user scroll inside detaches the window's follow (re-attach at bottom).
  • Toggle: chevron rotates 90° (› ↔ ▾) 160 ms spring.snap; body height animates dur.collapse (grid 0fr ↔ 1fr style; Claude desktop expands in .2 s, Cline 250 ms max-height, note 08); body opacity 0 ↔ 1 over 120 ms, starting 40 ms after height on open, ending before height on close.
  • Auto-collapse: 400 ms wait → header verb rolls to past tense (240 ms) while the body folds (200 ms); shimmer finishes its current sweep ≤ 400 ms or fades.
  • Hover (done): header text to full fg (from 85 %), chevron nudges 2 px in the open direction (120 ms); tooltip after 600 ms: "Thought for 12 s · 1,240 tokens" when known.
  • Redacted 🔒: lock fades in with the past-tense roll; no special animation.
  • Interrupted: header swaps to "Stopped thinking after 8s" with the status strip's drop timing (220 ms ease.firm); body collapses immediately (no 400 ms wait).
  • Level switch: all unpinned blocks animate together (one batch, no stagger) plus the 1.5 s toast.
Timing
TransitionDurationDelayEasing / springStaggerFrame rate
Appear (header)180 ms, y +4 → 0show_delay 300 msease.out—60 Hz
Body window growcontinuous with content, cap 160 px—spring.snap per line—60 Hz
Header shimmerper text-shimmer/calm600 ms after text changeease.coast—30 Hz
Timer tick1 Hz, digit roll 280 ms—ease.out30 ms30 Hz
Live subtitle swap180 ms≥ 2 s since last swapease.out—30 Hz
Toggle chevron160 ms0spring.snap—60 Hz
Expand / collapse height200 ms (dur.collapse)0cubic-bezier(0.22, 1, 0.36, 1) (ease.out)—60 Hz
Body opacity (open / close)120 ms40 ms / 0ease.out / ease.in—60 Hz
Auto-collapse400 ms wait + 200 msreader guard + 1500 msease.in-out—60 Hz
Present → past roll240 ms (dur.tense.roll)after shimmer endsease.out—60 Hz
Interrupted swap220 ms0ease.firm—60 Hz
Level-switch batch200 ms + toast 1.5 s0ease.in-outnone60 Hz
Reduced motionno shimmer (plain "Thinking"), timer digits swap without roll, height snaps with an 80 ms opacity crossfade, no chevron rotation (glyph swap), subtitle swaps by 80 ms crossfade every ≥ 4 s, auto-collapse still waits 400 ms then snaps—linearnone1 Hz timer

Responsive behaviour

  • The header is 44 px in every state; actions never shift it.
Edge cases (spec)
  • Very short thinking (< 300 ms): never shown. 300 ms – 1 s: "Thought briefly".
  • Very long thinking (> 10 min): timer switches format (10m 04s, 1h 02m per elapsed-timer); live window keeps the tail only (older lines virtualised); subtitle swaps slow to every 4 s (proposed).
  • Huge reasoning bodies (> 50 KB): expanded Done view virtualises like any message body; "Show all" past 40 lines.
  • Thinking ↔ tool bouncing every few hundred ms: the 400 ms collapse delay absorbs it; if a turn produces > 6 segments, segments after the 6th auto-merge into the previous block with a thin divider (proposed) to avoid a wall of headers.
  • Reasoning after the answer started (some models interleave): the new segment appears below the answer text so far, collapsed in Normal/Thinking levels ("Thought for 3s ›"), never above it.
  • Redacted then raw in the same turn: each segment keeps its own kind.
  • Timestamps missing: header "Thought" without a duration; never show "Thought for 0s".
  • Offline / stalled mid-thinking: the status row and header stall ramp handle it; the block keeps its partial body.
  • RTL: header mirrors (chevron points to the inline-start when collapsed: ‹ in RTL), duration in a bidi isolate; body follows text direction; leading rule moves to the right.
  • CJK: subtitle truncation counts graphemes ×1.6 weight (status-text §5.6).
  • Tiny sizes: reasoning-block/dense 20 px row; at < 240 px the header shows only the timer and a 12 px glyph.
  • Dense IDE: default level Normal for IDE presets (proposed) — side panels are short.
  • Touch: whole header is the toggle (≥ 44 px tall on mobile); live window scrolls inside with axis lock.
  • Background tab: body reveal pauses; on return, received text appears with one block fade (text-reveal); the collapse that would have happened applies instantly.
  • Copy: message copy excludes reasoning except in Verbose; the block's own ⋯ → Copy reasoning copies visible (non-redacted) text only.

Notes for AI

  • Import ReasoningBlock from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: ReasoningEl in oxyn_gpui.
  • Props to set first: reasoning.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI