Getting StartedInstallation and setup guides 6
AIAI chat models, streaming, and history 1
FormInput and selection components 27
FlowWorkflow graph and execution surfaces 4
LayoutStructural layout components 9
NavigationMenu surfaces and hierarchical actions 7
OverlayModal and floating layer surfaces 3
FeedbackStatus, empty, progress, and loading placeholder patterns 6
UtilityGeneral-purpose interface utilities 7

AI foundation

AI Chat

Render a professional provider-neutral chat with a canonical message model, bounded DOM, custom Angular message parts, cursor-paged history, and an optional AG-UI 1.0 adapter.

Recommended integration: use tng-ai-chat for the complete presentation and interaction layer. Your application still owns transport, persistence, authentication, and agent execution.

Imports

Install the core package. Add the AG-UI peer only when consuming the secondary adapter entry point.

Install AI chat packages

bash
pnpm add @tailng-ui/ai @ag-ui/core

Import the core and AG-UI APIs

ts
import { TngAiChatComponent, TngAiChatStore, TngAiHistoryController } from '@tailng-ui/ai';
import { TngAgUiReducer } from '@tailng-ui/ai/ag-ui';

Render the controlled chat component

html
<tng-ai-chat
  [messages]="messages()"
  [busy]="busy()"
  [partRenderers]="partRenderers"
  (messageSubmit)="send($event.text)"
  (stopRequest)="stop()"
/>

Architecture

Application owns

Transport, persistence, authentication, agent execution, tool authorization, and product policy.

TailNG owns

Professional chat presentation, composer behavior, custom part dispatch, bounded DOM, scrolling, canonical state, history coordination, validation, and AG-UI reduction.

Canonical model

Messages are stable envelopes containing ordered, typed parts. Keep transport-specific event objects outside renderers and reduce them into this model at the application boundary.

Create a canonical message

ts
import type { TngAiMessage } from '@tailng-ui/ai';

const message: TngAiMessage = {
  id: 'message-42',
  threadId: 'thread-7',
  role: 'assistant',
  status: 'complete',
  parts: [
    {
      id: 'part-42',
      type: 'text',
      format: 'markdown',
      text: 'The release is ready.',
      status: 'complete',
    },
  ],
};

Memory strategy

Do not load an entire long conversation into the browser. Fetch older messages with opaque cursors and retain only the pages your product needs. tng-ai-chat bounds its rendered message window so thousands of supplied messages do not create thousands of DOM nodes.

  • Start with 40 messages; the controller clamps pages to 100 by default.
  • Prepend older pages; the chat component preserves the reader's scroll anchor.
  • Abort in-flight history requests when the active thread changes.
  • Persist older pages outside component memory and evict them using an application policy.

AG-UI boundary

The AG-UI adapter validates official 1.0 events before reducing run, text, tool-call, tool-result, and message-snapshot events into the same store. Unsupported or invalid events return diagnostics instead of reaching the UI unchecked.