Dashboard SDK
The dashboard is the control center for Wix sites. It allows users to manage their sites' settings and business features. The dashboard also includes tools for such as analytics, eCommerce, and marketing. Third-party apps can create custom dashboard integrations, including pages and widgets, that are displayed in the dashboards of users who install those apps as iFrames embedded to the Dashboard.
The Dashboard SDK is a tool that allows the code in custom dashboard components to interact with other parts of the Wix dashboard. Using the SDK, developers can navigate users to pages in the dashboard, display modals, and send users alerts and updates using toasts. The SDK makes it simpler and easier to create custom experiences for users in their sites' dashboards.
Setup
In order to use the Dashboard API, install the @wix/dashboard
package:
Install using npm
1npm install @wix/dashboard
Install using yarn
1yarn add @wix/dashboard
Next, create a client constant using the dashboard module:
1import { dashboard } from '@wix/dashboard';2import { createClient } from '@wix/sdk';3
4const client = createClient({5 host: dashboard.host(),6 auth: dashboard.auth(),7 modules: {8 dashboard,9 },10});
You may now use the client
constant in order to interact with the dashboard. For example:
1client.dashboard.showToast({ message: 'Hello World' });
Before you begin
Before you start writing your code, keep in mind that the SDK automatically adjusts the heights of any dashboard components rendered within iframes. Because of this, do not use relative CSS height units such as vh
in your iframe component code.
Contact us
If you are using one of the legacy Wix SDKs and require a method that is not available in the Dashboard SDK, or alternatively if you would like to suggest a use case that fits the Dashboard SDK, reach out to Dashboard SDK Support for assistance.