Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

JS Component

No security coverage Under active development 344 sites

This module allows developers to easily integrate JavaScript or React components into Drupal. You can define these components using plugin definitions or by creating YAML files, enabling the collection of settings from site builders to be passed to the components.

Description

The module provides a streamlined solution for adding simple React or JS based components to the Drupal ecosystem. The module is more developer centric, as it allows developers to define JS components by exposing a plugin or by placing a YAML file within the module or theme directory.

The libraries directive follows the same syntax as what you would expect in a *.libraries.yml. The settings directive allows you to collect information from the site-builder. It follows the same structure as the Drupal form API. Inputted settings are exposed to the JS component using the drupalSettings concept.

Below is an example of what a JS component YAML base definition looks like.

[THEME/MODULE].js_component.yml

component_1:
  label: My React Component
  description: This app will run the world!
  root_id: root
  libraries:
    js:
      /js_component/react-app/build/static/js/main.ca4c6d6d.js: {}
    css:
      theme:
        /js_component/react-app/build/static/css/main.666d445f.css: {}
  settings:
    collect_user_input:
      type: 'select'
      title: 'User Input'
      description: 'Any data you would like to provide to the react application.'
      options:
        option-1: Option 1
        option-2: Option 2
      empty_option: '- Select -'

If you need to encapsulate a component as a twig template file. Which then you can define the following in the JS component definition:

component_2:
  label: Twig Template
  description: The basic twig template example.
  template: js_component/custom/twig-template.html.twig
  libraries:
    css:
      theme:
        /js_component/custom/main.css: {}
  settings:
    header_title:
      type: textfield
      title: Header Title
      description: Input JS component header title.

Ask your assistant about JS Component

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
1
Tracked since
Jan 2026
Latest release
9 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core PHP Release date
2.0.0-alpha3 Pre-release 10–11 Jan 15, 2026