Getting Started
Overview
Installation
Theme
Forms
Basic Inputs
Custom Inputs
Select
Components
Components
77
Micro Charts
Navigation
Libraries
Content Editor
Data View
Form Renderer
Image Designer
Kanban Board
Video Player
Visual Builder
Latest npm version of @ngstarter-ui/componentsWeekly npm downloads of @ngstarter-ui/components
Purchase

Content Editor Renderer API

The NgStarter Angular Content Editor Renderer API documents the inputs, provider helpers, renderer definition shape, and dynamic renderer input contract for rendering saved Content Editor JSON blocks as HTML.

Import the renderer and provider helpers from @ngstarter-ui/components/content-editor. Use ngs-content-editor-renderer with blocks produced by ngs-content-editor-builder.

import {
  ContentEditorRenderer,
  provideContentEditorRenderer,
  provideContentEditorRenderers,
  ContentEditorBlockRendererDef,
  ContentEditorBlockRendererInputSignals
} from '@ngstarter-ui/components/content-editor';

Selector

<ngs-content-editor-renderer [content]="blocks"/>

Inputs

InputTypeDefault
content
Saved content editor blocks to render. Use this for persisted block JSON and preview data.
ReadonlyArray<ContentEditorBlock>[]
blocks
Alternative input for the same block array. When provided, it takes precedence over content.
ReadonlyArray<ContentEditorBlock> | nullnull

Renderer Providers

APITypeNotes
provideContentEditorRenderers(renderers)
Registers multiple custom block renderer definitions through an environment provider.
EnvironmentProvidersAdds to default renderers
provideContentEditorRenderer(renderer)
Registers one custom block renderer definition.
EnvironmentProvidersAdds to default renderers
CONTENT_EDITOR_BLOCK_RENDERERS
Multi provider token used internally by the renderer to collect registered renderer definitions.
InjectionToken<ReadonlyArray<ReadonlyArray<ContentEditorBlockRendererDef>>>[]

Renderer Definition

PropertyTypeRequired
type
Block type handled by this renderer, for example paragraph, heading, image, or a custom block type.
stringRequired
component
Standalone Angular component used for blocks with the matching type.
Type<unknown>Required

Dynamic Renderer Inputs

Custom renderer components receive these inputs from ngComponentOutletInputs. Use ContentEditorBlockRendererInputSignals when declaring renderer inputs with Angular input().

InputTypeDefault
block
Original block object passed to the renderer.
ContentEditorBlock | nullnull
id
Block id.
string''
type
Block type used to resolve the renderer.
string''
content
Block content payload. The shape depends on the block type.
TContentundefined
props
Inline or block-level properties saved by the editor.
ContentEditorItemProperty[][]
settings
Block settings payload. The shape depends on the block type.
TSettings{}
index
Zero-based block position in the rendered content array.
number0