Dashboard and card widgets
Where to show widgets, how to adjust their height and employee access.
Machine translation
Purpose and dashboard widget
In the service settings, select Purpose of the service:
- The usual service — a separate item in the services menu.
- Dashboard Widget — a card in the employee's workspace instead of a menu item.
After selecting the widget, a bar appears Widget Settings. It independently sets Allow in the web version and Allow in the mobile version. These switches are available during creation and in the service settings. Mobile display is enabled by default, including for existing services; the web display setting remains the same. If you turn off both switches, the widget will not be available to employees on any platform, but will remain in the administrator's list for configuration. The data and the published code are not deleted.
Turn it on Automatic height so that the size adjusts to the content in both the web and mobile app: when the fields appear, the card grows, and when it collapses, it decreases. The general application page scrolls. By default, the setting is disabled and the existing widgets retain their sizes.
When the automatic height is turned off, two independent sliders are available.:
- Height on mobile — from 60 to 800 logical pixels, step 10; standard height 100.
- Height in the web version — from 120 to 800 pixels, step 20; standard height 280.
The title of the card is not included in the height of the content. Button By default returns both standard sizes. Turning on the automatic height does not erase the manual values: after turning off the switch, they return.
In the mobile app, the widget uses the same WebView and native bridge as a regular service: SDK, company context, artifacts, dialogs, and other supported methods continue to work. Holding down the header opens the workspace setting: the widget can be hidden, returned, and moved. In this mode, the service widgets display their contents, as well as the built-in cards. To move the service widget, hold down its title or any area of the content, then drag the card. The buttons, margins, and internal scrolling of the widget do not respond to touch in this mode; the visibility switch next to the title remains available. After clicking Done the usual interaction returns. The position and visibility are saved for the employee. The hidden widget does not run outside of edit mode. The upload error shows a retry button inside the card.
The widget appears in the web dashboard only when "Allow in web version" is enabled. You need a valid license Applications, enabled service, employee access, and published code. The name, height, and content are taken from the service; the draft is not shown. Order and visibility management is located in Widgets dashboard settings are saved in this browser separately for the user and the company.
In the web version, widgets are supported for services HTML, CSS, and JavaScript. External URL services are available as widgets only on mobile devices: the deleted page is not transferred to the Shadow DOM.
Automatic height and widget code
The automatic size works in all widget locations; regular services remain unchanged. The mobile app needs a version with automatic height support. For a mobile widget with an external URL, the size is also determined by the page content. Web widgets by external URL are still not supported.
Place the content in the normal flow of the document. Do not set a fixed height, 100vh or the height as a percentage of the window for the main content: this size depends on the window, not on the margins. Internal areas with a set height and their own scrolling, such as text editors, retain their behavior. Width changes, image loading, and fonts are taken into account. On mobile, the maximum height is 20,000 logical pixels; for large data sets, use pages or collapsible sections.
The code of the web widget
Shadow DOM separates the markup and CSS of the card from the dashboard, but it is not the boundary of JavaScript security.. Publish only the trusted company code here: unlike the iframe of a regular service, the JavaScript of the widget is executed in the context of the page. Do not use parent, top, cookies and the internal APIs of the web application. The user and company authorization keys are not transmitted to the code; receive the data through the SDK and the bridge verified by the server.
Regular HTML/JS and React/JSX are supported. Mount React via createRoot(document.getElementById('root')); searching for elements through the passed document it is limited by its widget, so the same id They don't conflict in different cards. Write the executable code in the tab JavaScript, not in inline HTML handlers or <script>. For the background, text, and elements, use the SDK theme and CSS variables; changing the theme updates the widget without losing its state. When hiding React-roots, they are unmounted, timers and SDK subscriptions are cleared. Unsubscribe from your own external subscriptions in the cleanup of React Effects.
The SDK environment remains web: synchra.getRuntime() returns web, mobile actions do not start and return the flag ignored. In the mobile WebView environment — mobile. Widgets are also supported in the cards and on the control screen — see below.
Card and management widgets
In Purpose of the service in addition to the usual service and dashboard widget, there are:
| Appointment | Display location |
|---|---|
| Task Widget | At the end of the task card, before the comments |
| Incident Widget | At the end of the main incident card, before the comments |
| Document Widget | At the end of the document card |
| Exit Widget | At the end of the team's exit card |
| Session Widget | At the end of the session card |
| The Magazine widget | At the end of the event card/magazine events |
| Report Widget | After the contents and attachments of the report |
| Employee widget in management | At the end of the "Information" tab of the employee card |
| Control Screen Widget | On the web, under "Resources", in the mobile app, under basic analytics |
Without heading or margins. A standard switch with a description is available in the widget settings: it hides the header of the bar and removes the internal margins of the container simultaneously in the mobile and web versions. The content occupies the entire widget area with selected or auto-height; this is not the device's fullscreen mode. The service's own HTML/CSS margins are saved. The setting applies to all widget assignments; the normal service is displayed as before. The switch is turned off by default. On the mobile dashboard, movement and visibility management remains available in edit mode.
Customization Without heading or margins it is applied after saving the service.
You can create multiple services for a single appointment. They are added in separate cubes at the end of the card, before the comments, if any. The order is for creating services, from earlier to new ones. The appointment does not give access to the card: first, the employee opens the allowed entry, then the services available to him are loaded. The license is taken into account Applications, access to the service, its activation and publication; the corresponding switch is additionally checked on each platform Allow in the web version or Allow in the mobile version. Widgets do not run in the preview of the incident template. Web widgets with an external URL are not supported. Use the built-in code for them. The heights on mobile and on the web are configured separately, like for a dashboard widget.
A single recording context
The built-in SDK provides await synchra.getWidgetContext(). In a regular service without a card, the result is — null. A single object is returned in the widget:
{
"version": 1,
"placement": "task",
"provider_id": "108",
"entity": { "type": "task", "id": "42" },
"data": {
"id": 42,
"title": "Проверить оборудование",
"description": "Осмотр перед сменой",
"status": "in_progress"
}
}
placement — dashboard, task, incident, document, field_visit, visit, journal, report, control_employee or control. The company ID and entries in the shared shell are always strings. For an employee entity.type — employee; for management and dashboard, the ID indicates the company. The magazine ID refers to the event, and the magazine ID is available in data when it is in the card.
data It contains the selected fields of the displayed record: name, description, status, available dates, priority and ID of related participants; the set depends on the card, missing fields are not artificially created. The management context includes current filters and statistics, and employee cards are the main profile data. The set of fields may vary between sections and platforms; check the availability of the field, do not count on mandatory description for all types. Passwords, tokens, secrets, and other authorization credentials are not included in the context. Context — interface data, not proof of authority: for operations, the server must check access separately.
Updates arrive without restarting the widget. Subscribe to synchra.onWidgetContextChange(callback) and call the returned unsubscribe function when unmounting:
import React, { useEffect, useState } from 'react';
function RecordInfo() {
const [context, setContext] = useState(null);
useEffect(() => {
let active = true;
synchra.getWidgetContext().then(value => { if (active) setContext(value); });
const unsubscribe = synchra.onWidgetContextChange(setContext);
return () => { active = false; unsubscribe(); };
}, []);
return <p>{context?.data?.description ?? 'Описание не указано'}</p>;
}
In an external mobile service with the old SDK package, you can call synchra.requestPayload('app.widget.context'); synchronous reading supports window.getSynchraWidgetContext(). When switching to another record, widget instances are created anew so that data from different cards does not mix.
Available placements
Select a location in the service settings from the available destinations. The extension developer does not need to change the Synchra24 code or connect its interface components. To work with an open record, use getWidgetContext() and check for the required fields.
Summaries from automations
To load the data for the first time, provide a skeleton in the widget code with the same layout as the finished summary: the title, tiles, and graph area take their place in advance. This is especially important when the height is automatic. When reading it again, save the already loaded values on the screen; replace them only after a successful response. The skeleton should not show fictitious zeros, and the error or absence of a configured source should have a separate understandable state. Keep in mind the system's motion reduction setting.
In the web dashboard, the initial skeleton can be shown before JavaScript is launched. Put its markup in the tab HTML, styles — to the tab CSS; mark the download area role="status" or aria-busy="true". The skeleton, which is created only inside React after running the code, does not close the earliest stage of loading. The dashboard receives the published widgets available to the employee in advance and their initial markup. This works both when the page is fully opened and when navigating from another section of the application: the skeleton takes up space until the card is shown for the first time. If there is a temporary error updating the list, the card that is already open is saved; disabling access continues to be taken into account. For a widget without initial markup, the set height is used during loading, then the automatic size is enabled.
For a summary that collects scheduled data, you can install a widget and automation package. After installation, set up the connection according to the instructions in the product profile, perform a verification and regular launch of the importer, and then turn on the schedule. The test run itself does not update the widget data.
Pay attention to the time of the last successful collection: opening the widget or the reread button does not necessarily trigger automation again. Unavailable and outdated indicators should be explicitly marked; missing data does not mean a zero result. The comparison for the period appears only after accumulating sufficient history. If the summary contains a graph, it should be based on saved snapshots: missing periods cannot be replaced with zeros. In the basic form, the indicators, the schedule period and the time of the snapshot are sufficient; definitions and reading rules can be included in the instructions of the product card. Errors, missing and outdated data should remain noticeable. Explain the collection gaps in the instructions. When selecting different indicators, update the line signatures, values, and scale; do not mix the number of events per period with the state at the time of the snapshot.
Access to the summary depends on the selected storage method. When reading automation artifacts The SDK retains the API license requirements and integration management rights. Do not extend the rights of an ordinary employee just to view such a widget; check the product requirements in the store in advance.