Building DHIS2 Capture Plugins (React+TypeScript)

This community innovation has been accepted at the 2026 DHIS2 Annual Conference and will be included a session.


Building DHIS2 Capture Plugins (React+TypeScript)

DHIS2 Capture provides native support for Form Field Plugins, a first-class extensibility mechanism for Capture. For developers, this enables customization of Capture forms through small React components that inject UI elements and execute form logic, without forking core Capture code. This keeps customizations maintainable and compatible with DHIS2 upgrades. Form Field Plugins provide a clean extensibility layer for Capture, enabling enhancements like external integrations, inter-field automation, input normalization, and contextual guidance, while keeping implementations aligned with core DHIS2 patterns. We present four technical patterns: Zip code lookup plugin: triggers on ZipCode updates and auto-populates City and State. The implementation uses DHIS2 Routes as a proxy to call an external API, avoiding exposure of credentials and reducing coupling to third-party services. Headless automation plugin (DOB/Age): a non-visual plugin that reacts to form state changes and updates dependent fields. It supports multiple input date formats, normalizes stored values, and ensures consistent derived values. Contextual OptionSet guidance plugin: adds explanatory texts next to options for high-density OptionSet questions. Mappings are stored in the DataStore and can reference DHIS2 constants for translation, enabling dynamic content. Enrollment plugin: adds explanatory texts next to options for high-density OptionSet questions. Mappings are stored in the DataStore and can reference DHIS2 constants for translation, enabling dynamic content without redeploying the plugin. From an engineering perspective, these plugins are implemented as isolated modules using React + TypeScript, with a clearly defined plugin interface for interacting with Capture’s form state and field bindings. Using d2-app-scripts enables rapid iteration with hot reload, while keeping the plugin codebase small, testable, and decoupled from the main DHIS2 application.

Primary Author: Arriola Matías


Keywords:
Capture; Form Field Plugins; extensibility; React; TypeScript; Routes; DataStore; Tracker; automation; validation

We’re looking forward to present “Building DHIS2 Capture Plugins” in a session! It is scheduled for Wednesday 17th June at 11:00 - 12:00 in auditorium 2 in Vilhelm Bjerknes house. See you there!

Hi

Thanks for these posts! Quite helpful, and the session details will also be available in the agenda page in the dac2026.dhis2.org website. Online participants will also receive access to the zoom links and agenda updates.