Skip to content

Widget

@wuespace/telestion / index / Widget

A widget that can be used in widget instances on dashboards.

See

userData.WidgetInstance

Type parameters

T extends BaseWidgetConfiguration = BaseWidgetConfiguration

the type of the widget configuration

Properties

configElement

configElement: ReactNode

A configuration element that is used to configure the widget.


element

element: ReactNode

A function that takes the configuration of the widget and returns a React element that represents the widget.


id

id: string

Represents an identifier of the widget type.


label

label: string

Represents a human-readable label of the widget type.

Methods

createConfig()

createConfig(input): T

A function that takes an object that contains the previous widget configuration (which may or may not be from a previous version of the client (or could also, when creating new widget instances, be empty) and returns a valid configuration for the widget.

For widgets with expected breaking changes, it is therefore useful to have some version identifier be a part of the configuration options to enable more complex migration logic in this function.

Parameters

input: Partial<T> & Record<string, Json>

previous configuration or empty

Returns

T