Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

SVG.js

No security coverage
View on drupal.org

This project integrates the SVG.js library into Drupal, allowing for easy creation, manipulation, and animation of SVG graphics. It provides a clean JavaScript API that can be used in themes, modules, or inline for interactive visuals without requiring complex configuration.

SVG.js for Drupal integrates the SVG.js library with Drupal, giving site builders and developers a lightweight way to create, manipulate, and animate SVG graphics on any page. It works out of the box and can load SVG.js from a CDN or a local copy, exposing a clean JavaScript API for interactive visuals.

Features

  • Zero-config default: Enable the module and start using SVG.js immediately.
  • Flexible library source: Auto-detect a local library or fall back to a trusted CDN.
  • Rich SVG API: Create shapes, apply transforms, handle events, and animate with method chaining.
  • Works anywhere: Use in themes, custom modules, or inline behaviors for dashboards, icons, maps, charts, and micro-interactions.

Post-Installation

No configuration page is required. After enabling the module, the SVG.js library is available globally. You can attach it in a theme or module and write SVG.js code in your JS files. The module will use a local library if present; otherwise it loads from a CDN automatically. :contentReference[oaicite:0]{index=0}


Example: attach the library in a module

// mymodule.module
function mymodule_page_attachments(array &$attachments) {
  $attachments['#attached']['library'][] = 'svgjs/svgjs.js';
}


Example: use in a Drupal behavior

(function (Drupal, once) {
  Drupal.behaviors.exampleSvg = {
    attach: function (context) {
      once('example-svg', '.svg-target', context).forEach(function (el) {
        var draw = SVG().addTo(el).size(300, 300);
        draw.rect(100, 100).fill('#f06').animate(800).move(150, 150);
      });
    }
  };
})(Drupal, once);

Additional Requirements

  • Drupal: Drupal 8.8+ (including 9/10/11). :contentReference[oaicite:1]{index=1}
  • Library: SVG.js (auto-loaded from CDN by default; optional local install at /libraries/svgjs/, e.g., /libraries/svgjs/dist/svg.min.js). :contentReference[oaicite:2]{index=2}
  • SVG asset modules (e.g., “SVG image”, “SVG Formatter”): manage/upload SVG files while this module handles client-side manipulation/animation.

Similar projects

Modules that enable SVG files or responsive images focus on rendering uploaded SVGs. This project is different: it exposes the SVG.js runtime API so you can script and animate SVG elements directly in the browser.

Supporting this Module

If you’d like to support development (sponsorships, bug bounties, feature requests), add your Patreon/OpenCollective links here.

Community Documentation

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Sep 2025
Latest release
11 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core Release date
1.0.0-alpha1 Pre-release 8–11 Sep 9, 2025
1.0.x-dev Dev 8–11 Sep 9, 2025