Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module adds lazy loading capabilities to your Drupal website, allowing content to load only when needed. It also enables HTMX-powered views for more interactive content display.

The HTMX Extras module adds some lazy loading functionality to your website.

Currently, these elements are implemented:

  • Lazy load entity: A template to lazily load an entity render
  • Lazy load route: A template to lazily load the contents of a given route
  • Search API lazy load row plugin: Renders your views lazily when they're revealed in the viewport (completely customizable, uses the "Lazy load entity"-template)
  • HTMX-powered views (see more below the examples)

More functionality will be added once the need arises, feel free to create a ticket if you have a use case that could fall under this module's scope.

For replacing Drupal's AJAX API with HTMX, we gladly refer to the excellent HTMX-project

Examples:

Entity

use Drupal\htmx_extras\Render\HtmxEntityPartial;

// ...

// From plain parameters:
$build = HtmxEntityPartial::fromParameters($entity_type, $entity_id)
          ->setViewMode($view_mode)
          ->setOption('language', $language)
          ->setHtmxParameter('trigger', 'intersect once')
          ->render();

// From an entity object, note that the language parameter is derived from the entity object and does not need to be set manually:
$build = HtmxEntityPartial::fromEntity($entity)
          ->setViewMode($view_mode)
          ->setHtmxParameter('trigger', 'load')
          ->render();

Route

use Drupal\htmx_extras\Render\HtmxRoutePartial;

// ...

$build = HtmxRoutePartial::fromRoute('my_module.route_name', ['parameter1' => 'value1'], ['language' => $language])
          ->setHtmxParameter('trigger', 'load')
          ->render();

HTMX-powered views

In 1.0.4, a big new feature called "HTMX views" was added.
This allows the webmaster to add a view that rivals the reactivity of full blown react apps, but with almost fully Drupal core-powered technologies.
It does use AlpineJS for small pieces (mainly updating the URL history in the browser).

This patch is needed for the pager to work properly: https://www.drupal.org/project/facets/issues/3008615

Full steps:

  1. Add a REST Export-display to your desired view
  2. Make sure to use the "Facets serializer"-display format and after applying the patch above, turn on "Display pager and results"
  3. Make sure to use 'fields' and only add the "Item ID"-search API field, and in the fields settings (under format) give it the alias, e.g. "id".
  4. Use the "Full"-pager and configure however many items per page you'd like to see
  5. Configure your view as necessary (filters, sorts, ..) but use normal facets (not the new views exposed facets from facets 3.x, these are currently not yet supported).
  6. Go to /admin/structure/htmx-view and create a new HTMX view
  7. Configure it as you'd like, remember to use the "id"-alias in the "Item ID"-field mapping

Activity

Total releases
10
First release
Oct 2025
Latest release
8 months ago
Releases (12 mo)
10 ▲ from 0
Maintenance
Slowing

Release Timeline

Releases

Version Type Release date
1.1.x-dev Dev Nov 16, 2025
1.0.7 Stable Nov 11, 2025
1.0.6 Stable Nov 11, 2025
1.0.5 Stable Nov 10, 2025
1.0.4 Stable Nov 10, 2025
1.0.3 Stable Nov 9, 2025
1.0.2 Stable Nov 4, 2025
1.0.1 Stable Nov 4, 2025
1.0.0 Stable Oct 31, 2025
1.0.x-dev Dev Oct 31, 2025