# Reasoning > A collapsible block that streams a model's thinking. Source: https://shellui.dev/docs/v0.4/components/advanced/reasoning `Reasoning` is **new in v0.4.0**. It shows a model's reasoning in a collapsible block: open while `IsStreaming` is true, labelled "Thinking…", then folded to "Thought for N seconds" when streaming ends. The user can open it again with a click. ## Installation ```bash shellui add reasoning ``` ## Usage ### Streaming Append to `Text` as chunks arrive and call `StateHasChanged()`. Set `IsStreaming` while they arrive and `Duration` when they stop. ```razor
@code { private string? text = "Press Run to stream a model's reasoning into this block."; private bool streaming; private TimeSpan? duration; private async Task RunAsync() { text = ""; duration = null; streaming = true; var started = DateTime.UtcNow; foreach (var word in "The user wants to know how dialogs keep focus. I should search the docs for the focus trap, then summarise what Tab does inside an open dialog.".Split(' ')) { text += word + " "; StateHasChanged(); await Task.Delay(90); } streaming = false; duration = DateTime.UtcNow - started; } } ``` ### Title and child content `Title` replaces the label, and child content is rendered after `Text`, so the body can hold markup. `DefaultOpen` opens it on first render. ```razor
  1. Find the pages that mention the focus trap.
  2. Read the Dialog accessibility section.
  3. Answer with a short example.
``` ## Behaviour - On first render the block is open if `DefaultOpen` or `IsStreaming` is set. - When `IsStreaming` changes, the block follows it: it opens when streaming starts and closes when it ends. A click toggles it in between. - The label is `Title` if set; otherwise "Thinking…" while streaming, "Thought for N seconds" once `Duration` is set (rounded, at least 1 second), and "Reasoning" before either. ## API Reference | Parameter | Type | Default | Description | |-----------|------|---------|-------------| | `Text` | `string?` | `null` | The reasoning text; line breaks are kept | | `ChildContent` | `RenderFragment?` | `null` | Markup shown after `Text` | | `IsStreaming` | `bool` | `false` | Opens the block and pulses the label while true; closes it when it turns false | | `Duration` | `TimeSpan?` | `null` | How long the model thought, shown once streaming ends | | `Title` | `string?` | `null` | Replaces the "Thinking…" / "Thought for …" label | | `DefaultOpen` | `bool` | `false` | Opens the block on first render | | `Class` | `string?` | `null` | Additional CSS classes | ## Accessibility - The header is a `