Skip to content

AIDK API Reference / aidk-angular / TextBlockComponent

Class: TextBlockComponent ​

Defined in: packages/angular/src/blocks/text-block.component.ts:57

TextBlock component - displays text content from AI responses.

This component provides the raw text and lets you handle rendering. For markdown rendering, provide your rendered content via ng-content or use the renderedHtml input for pre-rendered HTML.

This decoupled approach gives you control over:

  • Which markdown library to use (ngx-markdown, marked, etc.)
  • Sanitization (DOMPurify, Angular's built-in, etc.)
  • Custom styling and components

Examples ​

html
<aidk-text-block [block]="block"></aidk-text-block>
html
<aidk-text-block [block]="block">
  <markdown [data]="block.text"></markdown>
</aidk-text-block>
html
<aidk-text-block [block]="block" [renderedHtml]="sanitizedHtml">
</aidk-text-block>
typescript
// In your component
renderMarkdown(text: string): SafeHtml {
  const html = marked.parse(text);
  return this.sanitizer.bypassSecurityTrustHtml(DOMPurify.sanitize(html));
}

Constructors ​

Constructor ​

ts
new TextBlockComponent(): TextBlockComponent;

Returns ​

TextBlockComponent

Properties ​

PropertyTypeDefault valueDescriptionDefined in
block| TextBlock | ReasoningBlockundefined-packages/angular/src/blocks/text-block.component.ts:58
className?stringundefined-packages/angular/src/blocks/text-block.component.ts:59
hasProjectedContentbooleanfalseSet to true if you're providing content via ng-content. This prevents the plain text fallback from showing.packages/angular/src/blocks/text-block.component.ts:71
renderedHtml?stringundefinedPre-rendered HTML content. If provided, renders this instead of plain text. IMPORTANT: Ensure this is sanitized before passing (e.g., via DOMPurify).packages/angular/src/blocks/text-block.component.ts:65

Released under the MIT License.