ngx-prompt-kit

Branch Nav

ngx-prompt-kit original — not part of ibelick/prompt-kit

Sibling-message version navigation. Renders a 1-indexed counter flanked by prev/next arrows. The component does not own the branch state — consumer manages which branch is current and listens for (changed).

Examples

Compact

Set [compact]='true' for the '1 / 3' format. Arrows disable at edges; Left/Right keys navigate when the component has focus.

2 / 5

Current branch: 2

Verbose, below an assistant message

Default verbose format reads naturally as a caption. Wire (changed) to swap which sibling content shows in the bubble above.

AI Tailwind v4 introduced a CSS-first configuration model — most theme customisation now lives in your stylesheet via the @theme directive.
Branch 1 of 3

Single branch — renders nothing

When [total]='1' the component renders nothing — there's no point in branch nav for a single sibling. The 'no value to render' surface area below shows the example container's natural padding.

(component intentionally renders nothing)

Installation

Add the branch-nav component (and the cn() utility) to your project.

ng generate ngx-prompt-kit:branch-nav

Component API

PkBranchNav

PropTypeDefaultDescription
currentnumber1-indexed current branch (required).
totalnumberTotal branch count. Component renders nothing when total ≤ 1.
compactboolean false Renders "1 / 3" instead of "Branch 1 of 3".
classstringExtra classes for the host.

Outputs

PropTypeDefaultDescription
changed(next: number) => voidFires when the user navigates. 1-indexed. Consumer updates current to reflect.