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 ​
| Property | Type | Default value | Description | Defined in |
|---|---|---|---|---|
block | | TextBlock | ReasoningBlock | undefined | - | packages/angular/src/blocks/text-block.component.ts:58 |
className? | string | undefined | - | packages/angular/src/blocks/text-block.component.ts:59 |
hasProjectedContent | boolean | false | Set 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? | string | undefined | Pre-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 |