AboutSupportDeveloper GuideVersion 18.0.9

Interface DockProvider

Sample DockProvider definition.

The icon for DockProvider must be in a raster image format. An SVG is not processed.

Import required dependencies.

import { CustomDropdownItemActionPayload, init } from "@openfin/workspace-platform";
import { Dock, type DockProvider, DockButtonNames } from '@openfin/workspace';

Create provider object to pass to the static register function of the Dock type.

const provider: DockProvider = {
id: 'provider-id',
title: 'Sample Dock',
icon: 'https://www.openfin.co/favicon-32x32.png',
buttons: [
{
tooltip: 'Sample Button 1',
iconUrl: 'https://www.openfin.co/favicon-32x32.png',
action: {
id: 'sampleButton1',
},
},
{
type: DockButtonNames.DropdownButton,
tooltip: 'Sample Dropdown Button',
iconUrl: 'https://www.openfin.co/favicon-32x32.png',
options: [
{
tooltip: 'Dropdown Button 1',
iconUrl: 'https://www.openfin.co/favicon-32x32.png',
action: {
id: 'dropdownButton1',
customData: 'dropdownButton1 clicked',
},
},
{
tooltip: 'Dropdown Button 2',
iconUrl: 'https://www.openfin.co/favicon-32x32.png',
action: {
id: 'dropdownButton2',
customData: 'dropdownButton2 clicked',
},
},
{
tooltip: 'Button with sub-options',
options: [
{
tooltip: 'Nested button 1',
iconUrl: 'https://www.openfin.co/favicon-32x32.png',
action: {
id: 'nestedButton1',
customData: 'nestedButton1 clicked',
},
},
],
},
],
},
],
};

When a Dock button is clicked, the action object is passed to the customActions function defined as defined in the Workspace Platform init function.

Initialize your Workspace Platform with customActions to be invoked by dock dropdown.

await init({
browser: {},
customActions: {
"dropdownButton1": async (payload: CustomDropdownItemActionPayload) => {
alert(payload.customData)
},
"dropdownButton2": async (payload: CustomDropdownItemActionPayload) => {
alert(payload.customData)
}
}
});

Register Dock provider object.

await Dock.register(provider);

Show Dock.

await Dock.show();

Hierarchy

Properties

buttons?: DockButton[]

Buttons for platform-specific custom actions to display on the Dock.

clientAPIVersion?: string

version of client SDK, set by the API

disableUserRearrangement?: boolean

If true, the user will not be able to rearrange the buttons on the Dock.

Default

false
icon: string

Icon for the provider.

id: string

Unique identifier for the provider.

Remarks

A non-zero length string.

skipSavedDockProviderConfig?: boolean

By default, the Dock will save the user's configuration and restore it on the next launch.

If true, the currently stored configuration will be ignored and the Dock will use the configuration provided by the provider.

Default

false
title: string

A UI friendly title for the provider platform.

Controls the visibility of buttons for workspace components on the Dock. All components are visible by default, but you can hide any of them.

Default

  • All components are visible. ['switchWorkspace', 'home', 'notifications', 'store']