ngx-prompt-kit

Installation

Get ngx-prompt-kit wired into an Angular workspace. Components are distributed via schematics — the source lands in your project where you own it.

Prerequisites

Before installing, make sure you have:

Install Spartan UI

ngx-prompt-kit composes Spartan UI helm primitives. Install and initialize Spartan in your workspace first:

# requires @angular/cli installed globally
ng add @spartan-ng/cli
ng g @spartan-ng/cli:init
ng g @spartan-ng/cli:ui

When prompted, select at minimum these helm components: avatar, button, textarea, tooltip.

Add ngx-prompt-kit

One-time bootstrap. Patches the universal runtime deps (clsx, tailwind-merge) and warns if Spartan isn't detected.

ng add ngx-prompt-kit

Configure install path

Optional but recommended. Picks where component sources land and persists it to components.json so subsequent generates don't ask. Skip this and components will use the default libs/prompt-kit.

ng generate ngx-prompt-kit:init

Add components

Generate any component into your project. The cn() utility lands alongside automatically. Component-specific deps (e.g. marked for markdown, shiki for code-block) are added to your package.json when needed.

ng generate ngx-prompt-kit:message
ng generate ngx-prompt-kit:prompt-input
ng generate ngx-prompt-kit:markdown
# ...etc.

Components land at libs/prompt-kit/<name>/ by default. Override per command with --path, or set a workspace-wide path with ng g ngx-prompt-kit:init.

Bulk install (interactive)

Pick multiple components from a checklist instead of generating each one manually. The cn() utility and any component dependencies are still installed automatically.

ng generate ngx-prompt-kit:ui

Skip the prompt with --components=message,prompt-input,markdown.

Usage

Import the component into a standalone Angular component and use it:

import { Component, signal } from '@angular/core';
import { PkPromptInputImports } from 'libs/prompt-kit/prompt-input';

@Component({
  selector: 'app-chat',
  imports: [PkPromptInputImports],
  template: `
    <pk-prompt-input [(value)]="value" (submitted)="onSubmit()">
      <pk-prompt-input-textarea placeholder="Ask anything..." />
    </pk-prompt-input>
  `,
})
export class Chat {
  protected readonly value = signal('');
  protected onSubmit(): void {
    console.log('submitted:', this.value());
  }
}