Hierachical Term Selector
This module provides an improved interface for selecting taxonomy terms in a hierarchical structure. It allows users to navigate and select terms with dynamic loading and options for multiple selections or depth limitations.
The Hierarchical Term Selector (HTS) module for Drupal provides an advanced taxonomy term selection interface that lets users navigate and select terms from complex hierarchical structures. It improves on the standard taxonomy reference field with dynamic per-level loading, customizable labels, and support for multi-term selection across different branches. It is particularly useful for sites with intricate taxonomy requirements.
Which release do I use?
Two lines are maintained in parallel so no site is left without support. Choose by your Drupal core version:
- 2.x — Drupal 10.3, 11 and 12. The current line, rebuilt on a service-based architecture with PHP attribute plugins. Install:
composer require 'drupal/hts:^2.0@beta' - 1.x — Drupal 9 and 10. The original stable line, kept working for the sites already running it; no new features are planned here. Stay on 1.x if you run Drupal 9, or Drupal 10 below 10.3. Install:
composer require drupal/hts:^1.0
Features
- Hierarchical term selection: browse and select taxonomy terms with one selector per level, showing parent-child relationships clearly.
- Depth limitation: admins define how deep the hierarchy is displayed, focusing interaction on the most relevant levels.
- Dynamic AJAX loading: child levels load on demand via AJAX, improving the editing experience.
- Customizable labels and descriptions: per-level labels and descriptions guide users through the selection.
- Multi-term selection: select multiple terms across different branches, ideal for complex categorization.
- Views integration: use the HTS widget as an exposed filter for taxonomy term reference fields.
- 'None' option configuration: an optional 'None' entry per level lets users skip levels.
- Widget selector configuration: choose a plain select or Select2 element per level.
The 2.x line additionally provides:
- Hierarchy-aware field formatters: breadcrumb path, nested hierarchical list, and leaf-only.
- A Views exposed filter that narrows results to the whole selected subtree, plus a term-hierarchy Views field.
- Optional integration submodules, each depending only on its contrib module: HTS Search API (the cascading exposed filter on Search API-backed Views), HTS Better Exposed Filters (the HTS widget inside BEF forms), and HTS Facets (a hierarchical facet widget).
Configuration
After installing HTS:
- Go to the field settings of the content type where you want the hierarchical term selector.
- Choose Hierarchical Term Selector as the widget for your taxonomy reference field.
- Configure the hierarchy depth, labels, and other settings to match your content structure.
- Save. HTS loads the hierarchy levels dynamically as users interact with the selector.
Requirements
- 2.x: Drupal core
^10.3 || ^11 || ^12, plus the core Field and Taxonomy modules. Search API, Better Exposed Filters, Facets and Select2 are optional. - 1.x: Drupal 9 or 10, plus core Field and Taxonomy.
No additional modules are required for the basic widget.
Similar projects
- Simple Hierarchical Select (SHS) — a per-level taxonomy widget that can also create new terms and levels inline, force selection of the deepest level, and render with Chosen. HTS adds hierarchy-aware formatters and the optional Search API, Better Exposed Filters and Facets integrations, loads levels on demand via AJAX, and offers a Select2 element type.
- Client-side Hierarchical Select (CSHS) — preloads the whole hierarchy in the browser and can start from a given parent, require a value at each level, or save the full root-to-child lineage. HTS instead loads levels on demand via AJAX (better for large vocabularies) and adds the display-side formatters plus the optional Search API, BEF and Facets submodules.
Supporting this module
If you find HTS useful, please consider contributing to its ongoing development by reporting issues or submitting merge requests in the issue queue.