This repository contains the ThingsBoard Extension codebase. Follow the instructions below to integrate, develop, and deploy your custom widgets and components.
Install dependencies and start the development server:
yarn install
yarn start- Create a new widget in the ThingsBoard Widgets Library.
- In the Resources tab of the widget editor, add the following URL:
http://localhost:5000/static/widgets/thingsboard-extension-widgets.js - Ensure the "Is extension" checkbox is checked.
To compile the project for production, run:
yarn buildThe compiled file will be generated at: target/generated-resources/thingsboard-extension-widgets.js
After a successful build, deploy your extension to production in two steps:
- In the ThingsBoard UI, go to Resources > JavaScript library
- Click the "+" button in the upper-right corner
- Select Extension from the "JavaScript type" dropdown
- Enter a title for your extension
- Drag and drop the compiled file from the build output:
target/generated-resources/thingsboard-extension-widgets.js - Click Add
- Open or create a widget in the Widgets Library
- Go to the Resources tab
- Click Add, then check the "Is extension" checkbox
- Select your uploaded extension from the dropdown
- Use your custom component tag in the HTML tab
Your widget is now production-ready.
For more details, see the Advanced Development Guide.
To import ThingsBoard core dependencies into your extension components, use the following import structure:
import { <dependency> } from '<TB-module>/public-api';You can import from any of the following ThingsBoard modules:
@app/*@core/*@shared/*@modules/*@home/*
Note: Refer to the modules-map to see available types and dependencies.
Example:
import { WidgetConfig } from '@shared/public-api';To use third-party packages from the npm registry, add them using the Yarn package manager:
yarn add <package-name>Example:
yarn add lodashFor non-standard registries or alternative installation methods, please refer to the Yarn Documentation.
The examples/ directory contains ready-to-use widget examples configured for development mode. Each example includes a detailed README and a JSON config for import:
- example-table — basic widget creation (table with key-value pairs)
- example-chart — ECharts library integration
- example-table-with-custom-settings — custom settings (basic, advanced, and data key)
- example-table-with-custom-subscription — custom data subscriptions
- example-of-using-third-party-library — third-party npm packages (PrimeNG)
- example-action — custom actions with HTML templates
To ensure your extension remains compatible with the latest platform features, periodic updates are required.
Please refer to the Updating Guide for detailed migration scripts, framework updates, and version-specific instructions.