Drupal is a registered trademark of Dries Buytaert
cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). editoria11y 2.2.22 Minor update available for module editoria11y (2.2.22). ai 1.2.13 Minor update available for module ai (1.2.13). ai 1.3.2 Minor update available for module ai (1.3.2). moderated_content_bulk_publish 2.0.51 Minor update available for module moderated_content_bulk_publish (2.0.51). moderated_content_bulk_publish 2.0.50 Minor update available for module moderated_content_bulk_publish (2.0.50). editoria11y 2.2.21 Minor update available for module editoria11y (2.2.21). eca 3.1.0 Minor update available for module eca (3.1.0). sophron 3.1.1 Minor update available for module sophron (3.1.1). ai 1.3.1 Minor update available for module ai (1.3.1). seven 2.0.0-beta6 New beta version released for theme seven (2.0.0-beta6). seven 1.0.1-beta1 First beta version released for theme seven (1.0.1-beta1). layout_paragraphs 3.0.0-beta1 First beta version released for module layout_paragraphs (3.0.0-beta1). raven 7.3.8 Minor update available for module raven (7.3.8). bamboo_twig 6.0.7 Minor update available for module bamboo_twig (6.0.7). ebt_core 1.4.38 Minor update available for module ebt_core (1.4.38). ept_core 1.4.24 Minor update available for module ept_core (1.4.24). block_exclude_pages 2.2.2 Minor update available for module block_exclude_pages (2.2.2).

Webform Term Hierarchical Checkboxes provides a custom Webform element that renders a taxonomy vocabulary's terms as collapsible, hierarchical checkboxes.

By default only the root-level (depth 0) terms are visible. Checking a parent term reveals its direct children; unchecking a parent hides and deselects all its descendants. This behaviour works for any number of nesting levels.

Parent terms act purely as expand/collapse toggles. Only leaf-level terms (terms with no children) are ever submitted and stored as values.

Key features

  • Works with any taxonomy vocabulary, at any number of nesting levels.
  • Collapsible tree: children are hidden until the parent is checked.
  • Only deepest-level (leaf) terms are saved as submission values.
  • Optional validation rule: require at least one leaf-level term to be selected before the form can be submitted.
  • Progressive indentation based on term depth, rendered with CSS custom properties.

Requirements

Drupal 10 or 11
Webform module
Core Taxonomy module (drupal:taxonomy)
No additional libraries or composer packages are required.

Installation

Place the module folder inside web/modules/custom/ (or any modules directory that is scanned by Drupal).

Enable the module through the Drupal admin UI at Administration > Extend, or with Drush:
drush en webform_term_hierarchical_checkboxes

Configuration

Adding the element to a webform
Navigate to Administration > Structure > Webforms and open or create the desired webform.
Click Build to open the form builder.
Click Add element.
In the category Entity reference elements, select Term hierarchical checkboxes.
Configure the element in the dialog that opens (see settings below).
Click Save and then Save elements.

When a vocabulary has only one level of terms (no children), all terms behave as selectable leaves and the hierarchy toggle has no effect.

How it works

Browser behaviour (JavaScript)
On page load, all child terms (depth > 0) are hidden.
Checking a parent term reveals its direct children.
Unchecking a parent term hides and deselects all descendants recursively.
The caret icon (▶) next to a parent label rotates 90° when the parent is expanded.
Server-side value handling
All checked values are sent to the server on submission.
The server-side validate callback strips any checked parent (expander) terms before the values are saved. Only leaf-level term IDs are stored in the submission.
This stripping happens before Webform's own multiple-value count validation, so a configured Maximum number of values limit is evaluated against leaf selections only.

Activity

Total releases
1
First release
Apr 2026
Latest release
22 hours ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
1.0.x-dev Dev Apr 7, 2026