ngx-prompt-kit

Chain Of Thought

Vertical reasoning timeline. Each step is independently expandable; the connecting line stops at the last step.

Examples

Three-step reasoning

Default circle markers. Mark the final step with [last]=true so the connecting line ends cleanly.

Parsed 3 paragraphs and 2 code blocks. Detected language: TypeScript.
Visited 14 functions, found one cycle in the auth middleware between refreshSession and verifyToken.
Recommend extracting the token-refresh path into a separate module so the cycle is broken at the import boundary.

With per-step icons

Set [leftIcon]=true on the trigger and project a custom icon via the [leftIcon] attribute slot. Hover swaps it for the chevron.

Surveyed 12 prior implementations. Two recurring patterns: explicit step markers and implicit timeline animation.
Hot path: ResizeObserver re-measure on every step toggle. Batched into a single rAF dispatch.
Replaced per-step observers with a single shared one keyed by element. Memory footprint dropped 40%.

Installation

Add the chain-of-thought component (and the cn() utility) to your project.

ng generate ngx-prompt-kit:chain-of-thought

Component API

PkChainOfThought

PropTypeDefaultDescription
classstringExtra classes for the wrapper.

PkChainOfThoughtStep

PropTypeDefaultDescription
openmodel<boolean>Two-way bound open state. Leave unbound for uncontrolled.
defaultOpenboolean false Initial expanded state when uncontrolled.
lastboolean false Marks the final step so the connecting line stops here.

PkChainOfThoughtTrigger

PropTypeDefaultDescription
leftIconboolean false Reserve a left-icon slot. Project the icon via the [leftIcon] attribute (e.g. <ng-icon leftIcon hlm name="lucideSearch" />).
swapIconOnHoverboolean true Swap leftIcon for the chevron on hover.
classstringExtra classes for the trigger.

PkChainOfThoughtContent

PropTypeDefaultDescription
classstringExtra classes for the collapsing wrapper.

PkChainOfThoughtItem

PropTypeDefaultDescription
classstringExtra classes for the item.