Salesforce

Widgets in the aiWARE SDK

« Go Back
Information
Widgets in the aiWARE SDK
000004259
Public
Product Selection
aiWare - aiWare
Article Details

Widgets are pre-built user interface components that enable developers to quickly create graphical interfaces for applications. Widgets remain on the screen permanently, unlike panels, which are often mounted and unmounted as needed. Widget objects always contain a name, elementId and config.

Mount a widget

To display a widget in your app, use the mountWidget() method.

Tip: To see a list of all mounted widgets in the console, run aiware.store.getState().widgets.
  • In the callback function of aiware.init(), call aiware.mountWidget().

Parameters

The parameter of mountWidget() is:

NameRequiredTypeDescription
propsTrueObjectThe widget to mount.

This example mounts the App bar widget:

aiware.mountWidget({
name: 'APP_BAR',
elementId : 'my-app-bar',
config: {
    title: 'Library',
    backgroundColor: '#0000ff',
    help: true,
    zIndex: 1000,
    betaFeatures: true,
    notifications: true,
},
});
Tip: The mountWidget() method can be called anywhere in the code, but calling it inside init() ensures that init() finishes before the widget is mounted.

Unmount a widget

To stop a widget from displaying in your app, use the unmountWidget() method. - Call aiware.unmountWidget().

Parameters

The parameter of unmountWidget() is:

NameRequiredTypeDescription
widgetIdTrueStringThe ID of the widget to unmount. This ID is randomly generated.

App bar widget

The App bar widget is the toolbar. It displays your logo, icons, and system or app notifications.

Widget format

The App bar widget object uses this format:

{
name: 'APP_BAR',
elementId: 'my-app-bar',
config: {
    title: 'Library',
    backgroundColor: '#0000ff',
    help: true,
    zIndex: 1000,
    notification: true,
    displaySupportChat: true,
    rightActions: [ {
        label: '<HTML of your custom icon>',
        onClick: function(event) {
            // This code runs when the icon is clicked.
        }
    }],
    logoSrc: '<Absolute path to your logo>',
    hidePasswordReset: true
},
}

Properties

The App bar widget has these properties:

NameRequiredTypeDescription
nameTrueStringThe name of the widget. Must beĀ 'APP_BAR'.
elementIdTrueStringThe ID of the widget. Can be customized.
configTrueObject (config)The properties of the app bar.

config

The config object has these properties.

NameRequiredTypeDescription
titleTrueStringThe title that appears on the app bar.
backgroundColorTrueStringThe background color of the app bar. Accepts RGB, hex, and predefined colors (ex. red). The text color automatically adjusts to contrast with the background color.
helpTrueBooleanThe help icon visibility. true for visible, false for invisible.
zIndexTrueIntegerThe z-index of the app bar.
notificationFalseBooleanThe notification icon visibility. true for visible, false for invisible.
displaySupportChatFalseBooleanThe visibility of the Support Center menu option. true for visible, false for invisible. Default is true.
rightActionsFalseArray[Object (rightActions)]The custom menu icons to display on the app bar. Can contain an unlimited number of objects, but too many objects can clutter the UI.
logoSrcFalseStringThe absolute path of the image to use as the logo icon.

rightActions

The rightActions array has 1 or more objects with these properties. Each object represents an icon on the App bar.

NameRequiredTypeDescription
labelTrueStringThe HTML of the icon.
onClickTrueFunctionThe anonymous function that runs when you select the icon.
isActiveFalseBooleanThe state of the icon, which affects its opacity. true for active, false for inactive. Default is true.
Additional Technical Documentation Information
Properties
2/12/2024 11:00 PM
2/12/2024 11:01 PM
2/12/2024 11:01 PM
Documentation
Documentation
000004259
Translation Information
English

Powered by