The `di-widgets-framework` is a React-based library for creating interactive, customizable widget dashboards with integrated drag-and-drop functionality. Currently at version 1.9.6, it offers components like `WidgetPalette` for widget selection and `WidgetSettingsPanel` for extensive configuration, including styling, behavior, and type-specific options. This framework differentiates itself through dynamic loading of widget types from a backend API, built-in search for widgets, and a comprehensive settings panel supporting various widget categories (e.g., search, filter, results, analytics, header, footer, text, agent). While no explicit release cadence is stated, the versioning indicates active maintenance and development. It ships with TypeScript types for enhanced developer experience.
npm install dp-widgets-frameworkVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to integrate `WidgetPalette` into a React application, showing a basic setup for a widget dashboard environment and highlighting the `widgetBackendUrl` prop.
Always explicitly define `widgetBackendUrl` (e.g., `http://localhost:3001` or `/api`) for robust and predictable API routing, especially in production or complex deployment scenarios.
Ensure that `pageId` is a non-empty string and `widget` is a valid object adhering to the `Widget` interface before attempting to render `WidgetSettingsPanel`.
Verify that your project's `react` and `react-dom` versions are compatible with the framework's requirements (typically React 17 or 18+). Run `npm install` or `yarn install` to ensure peer dependencies are correctly resolved.
For types and interfaces, always use `import type { TypeName } from 'package-name';` to prevent accidental runtime imports and ensure proper type stripping during compilation. Review your `tsconfig.json` for strictness and module resolution settings.Ensure all components are imported using named ES module syntax, like `import { ComponentName } from 'di-widgets-framework';`, and that your build setup supports ES Modules.Before rendering components that rely on complex objects, ensure the data (e.g., the `widget` prop) is valid and complete. Implement defensive coding with optional chaining (`?.`) or conditional rendering.
Verify the `widgetBackendUrl` value for typos and ensure your backend service is running and accessible at that exact URL. Confirm that the required API endpoints are correctly implemented and exposed.