🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@templatical/types

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@templatical/types

Shared TypeScript types, block factory functions, and event emitter for Templatical email editor

Source
npmnpm
Version
0.8.3
Version published
Weekly downloads
2.7K
10.31%
Maintainers
1
Weekly downloads
 
Created
Source

@templatical/types

Shared TypeScript types, block factory functions, and type guards for the Templatical email editor.

npm version License

Zero-dependency package containing all shared types for the Templatical email editor ecosystem. Block schemas, template config, factory helpers, and type guards.

Use this directly if you need to programmatically create or transform Templatical templates — for example, in a backend service, codegen pipeline, or migration script.

Install

npm install @templatical/types

Usage

import {
  createTitleBlock,
  createParagraphBlock,
  createButtonBlock,
  isImage,
  isSection,
} from '@templatical/types';
import type { TemplateContent, Block } from '@templatical/types';

// Build a template programmatically
const content: TemplateContent = {
  blocks: [
    createTitleBlock({ text: 'Welcome to Templatical', level: 1 }),
    createParagraphBlock({ text: 'Build email templates visually.' }),
    createButtonBlock({ text: 'Get started', href: 'https://templatical.com' }),
  ],
  settings: { width: 600, backgroundColor: '#ffffff' },
};

// Type-narrow blocks safely
function describeBlock(block: Block): string {
  if (isImage(block)) return `Image: ${block.src}`;
  if (isSection(block)) return `Section with ${block.columns.length} columns`;
  return block.type;
}

What's exported

  • Block typesBlock, TitleBlock, ParagraphBlock, ImageBlock, ButtonBlock, SectionBlock, DividerBlock, SpacerBlock, SocialIconsBlock, MenuBlock, TableBlock, HtmlBlock, VideoBlock, CountdownBlock, CustomBlock
  • Factory functionscreateTitleBlock(), createParagraphBlock(), etc. for every block type
  • Type guardsisTitle(), isParagraph(), isImage(), isSection(), etc.
  • Template typesTemplate, TemplateContent, TemplateSettings
  • Theme typesThemeOverrides, UiTheme, BlockDefaults, FontsConfig
  • Config typesMergeTagsConfig, DisplayConditionsConfig, CustomBlockDefinition
  • Event emitterEventEmitter (used internally by core)
  • Merge tag presets — common merge tag definitions (Mailchimp, etc.)

Documentation

Full reference at docs.templatical.com.

License

MIT

Keywords

block-types

FAQs

Package last updated on 21 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts