ngx-prompt-kit

Reasoning

A collapsible component for showing AI reasoning, explanations, or logic. Auto-expands while a stream is in progress and collapses when it ends. Markdown supported. Built on spartan's brain collapsible, which measures the content for the open/close animation and puts aria-expanded / aria-controls on the trigger.

Examples

Basic Usage

The most basic implementation of the Reasoning component with auto-close functionality when streaming ends.

With Markdown

Show rich formatting with markdown support for better structured reasoning content.

Installation

Add the reasoning component (and the cn() utility) to your project.

ng generate ngx-prompt-kit:reasoning

Component API

PkReasoning

PropTypeDefaultDescription
openmodel<boolean> — Two-way bound open state. Leave unbound for uncontrolled.
isStreamingboolean false Auto-opens while true; auto-closes when it flips back to false.
classstring — Extra classes for the wrapper.

PkReasoningTrigger

PropTypeDefaultDescription
classstring — Extra classes for the trigger button.

PkReasoningContent

PropTypeDefaultDescription
contentstring — The body text. Optional — projected ng-content also supported.
markdownboolean false Render content as markdown via pk-markdown.
classstring — Extra classes for the outer collapsing wrapper.
contentClassstring — Extra classes for the inner content (use this for borders / padding so they collapse with the panel).