Template Editor

Template editor with toolbar and variable picker

SaaSTemplates

Overview

TemplateEditor provides a textarea-based editing interface for notification templates. It supports variable insertion via a picker, conditional block insertion, real-time validation errors, and read-only mode.

Usage

import { TemplateEditor } from "@leanicon/web-builder-library/saas";

<TemplateEditor
  value={content}
  onChange={setContent}
  variables={[
    { name: "user.firstName", description: "First name", dataType: "string", example: "Jane" },
    { name: "order.id", description: "Order ID", dataType: "string", example: "ORD-9821" },
  ]}
/>;

Variants

Read Only

Read Only (Dark)

Default (Editable)

Tip: Click the { } button or type {{ to insert variables

With Errors

Variable 'user.lastName' is not defined (line 1, col 14)
Tip: Click the { } button or type {{ to insert variables

Props

NameTypeDefaultRequiredDescription
valuestring—YesCurrent template content
onChange(value: string) => void—YesCallback when content changes
variablesTemplateVariable[]—YesAvailable variables for insertion
helpersFormattingHelper[]—NoAvailable formatting helpers
errorsTemplateValidationError[][]NoValidation errors to display
onValidate((content: string) => TemplateValidationError[])—NoCallback for real-time validation
isReadOnlybooleanfalseNoWhether editor is read-only
placeholderstringWrite your template content here. Use {{variable}} syntax to insert variables.NoPlaceholder text when empty
classNamestring—NoAdditional CSS class names
canEditbooleantrueNoPermission to edit (if false, renders read-only)