DatoCMS Character Counter Plugin

A DatoCMS plugin that automatically shows a character counter on fields that are configured to have validations on length.

Features

  • Automatic activation: The plugin automatically attaches to fields with length validators
  • Manual installation: Can also be manually added to fields
  • Multiple field types: Supports string, text, and structured_text field types
  • Smart counting: For structured text, counts only the actual text content (not markup)

Supported Field Types

  • Single-line string
  • Multiple-paragraph text
  • Structured text

How it works

The plugin uses the overrideFieldExtensions hook to automatically add a character counter addon to fields that:

  1. Are one of the supported field types (string, text, or structured_text)
  2. Have length validation configured
  3. Don't already have the character counter addon installed

The counter displays the current character count in a small, unobtrusive format below the field.

Implementation

Based on the official DatoCMS character-counter plugin.