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). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

JS Component

354 sites No security coverage
View on drupal.org

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.

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
7 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

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