Integrates Typed.js is a lightweight JavaScript library that types

Typed brings Typed.js to Drupal. It integrates the library with Drupal's asset library system, making the Typed JavaScript constructor available to themes and custom modules.

Typed.js creates typing animations by displaying text character by character, erasing it, and moving through a sequence of strings. It supports configurable typing and backspacing speeds, delays, looping, cursor display, and callbacks. Animations are initialized in JavaScript; the module does not provide a visual animation editor.

What does Typed.js do? Typed.js brings text-typing animations to Drupal. It types configured strings at your chosen speed, erases them, and cycles through the sequence—all controlled through JavaScript.

Choosing a module version

  • Typed 1.x: Supports Drupal 8.8, 9, 10, and 11. Recommended for existing sites using the stable 1.x release line.
  • Typed 2.x (beta): Targets Drupal 11.3+ and Drupal 12. Requires PHP 8.3 or later. Choose this line when preparing for Drupal 12 or using the modern integration. The 2.x release line is currently beta.

These are versions of the Drupal module, not versions of the Typed.js library. The 2.x module line supports local Typed.js v2 and v3 UMD browser builds. Its default CDN fallback uses Typed.js 2.1.0. Typed.js v3 must be installed locally. See the available releases.

Library licensing: Typed.js 2.1.0 is MIT-licensed. Typed.js 3.0.0 is GPL-3.0-or-later, and the upstream project also offers commercial licensing options. Review the applicable upstream license before using v3 in a commercial project.

Features

  • Integrates Typed.js with Drupal's asset library system.
  • Detects supported local Typed.js v2 and v3 UMD browser bundles.
  • Searches site-specific, global, and installation-profile library directories.
  • Supports three library directory aliases: typed.js, typed, and typedjs.
  • Uses deterministic library selection, prioritizing location, verified builds, and Typed.js v2 over v3 within the same location.
  • Attaches only one Typed.js library to avoid duplicate loading.
  • Falls back to a pinned Typed.js 2.1.0 CDN build with Subresource Integrity (SRI) when no supported local build is found.
  • Reports the selected library, version, license, ignored or incomplete copies, and outdated cache selections in Drupal's status report.

Installation

  1. Install a module release compatible with your Drupal version:
    • For the stable 1.x line, use composer require 'drupal/typed:^1.0'.
    • For the 2.x beta line, use composer require 'drupal/typed:^2.0@beta'.
  2. Enable the Typed module.
  3. Optionally install a local Typed.js browser bundle:

    Extract the archive and place its dist/typed.umd.js file in one of the supported library directories:

    • /libraries/typed.js/dist/typed.umd.js
    • /libraries/typed/dist/typed.umd.js
    • /libraries/typedjs/dist/typed.umd.js

    Keep the upstream package.json alongside the dist directory when available.

  4. Clear all Drupal caches after adding, replacing, or removing local library files.

A local library is optional. Without a supported local build, the module automatically falls back to Typed.js 2.1.0 from the CDN. The selected library and its status are displayed at /admin/reports/status.

Usage

Add your animation code to a JavaScript file in your theme or custom module. The library exposes the Typed constructor for initializing typing animations.

  
var typed = new Typed('.element', {
  strings: ['First sentence.', 'Second sentence.'],
  typeSpeed: 30
});

Customize the animation using Typed.js options such as strings, typeSpeed, backSpeed, backDelay, loop, and showCursor.

JavaScript integration: The module provides the library integration only. You write and initialize your animations in JavaScript using the API of the loaded Typed.js version.

Documentation and support

Similar projects

  • Textimate — text animation effects for Drupal.
  • Splitting.js — splits text into words and characters for custom visual effects.

Use typing animations thoughtfully. Keep essential content accessible without animation and respect users' reduced-motion preferences.

Project information

Releases