Skip to main content

Target Type: Any

An Any widget can be placed in any layout — View, Edit, Create, Home, Dashboard. Use it when the widget's logic does not depend on which specific layout it is on, and you want to reuse the same widget code across multiple layout types.

Any widgets are also visible in the mobile app for Create, Edit, and View layouts (unlike layout-specific widgets which may not be).


pageContext shape

Any widgets only receive the common pageContext. There is no instanceId, attributeValues, or layout-specific functions.

{
name, // Widget's registered name
displayName, // Widget's display label

// Common (always present — injected automatically)
settings, // Tenant date/time format, file types, etc.
userData, // Logged-in user info (name, roles, profile, etc.)
}

When to use Any

Use AnyUse a specific layout target
Static content or help textYou need attributeValues from a record
The same widget in multiple layoutsYou need onAttributeEdit or saveInstance
Notification bannersYou need totalData from a dashboard
Tenant-branding widgetsYou need selectedInstances from a bulk action

Example — Contextual help panel

A static instruction panel placed in the Create Layout to guide users through the form.

function UploadGuideWidget(pageContext) {
const { protrakComponents } = React.useContext(customWidgetContext);
const { Box, H4, H3 } = protrakComponents;
const baseURL = window.location.origin;

return (
<Box direction="column">
<H4>Hi {pageContext.userData.name},</H4>
<H3>Steps to upload a Scanned Agreement:</H3>
<ul>
<li>
<H4>
Go to the{' '}
<a href={`${baseURL}/Agreement/dashboard`} target="_blank">
Agreement dashboard
</a>
</H4>
</li>
<li>
<H4>Click the Edit icon to upload the Final Agreement file.</H4>
</li>
</ul>
</Box>
);
}

Preview:

target_type_any.png