# FDC3 UI Components

Canonical page: https://www.adaptabletools.com/docs/handbook-fdc3-ui-components

- This AdapTable Help Page is being actively updated
- AdapTable has just upgraded to FDC3 2.0 and we are working on updating the documentation

- It is easy for developers to raise FDC3 Intents or Broadcast FDC3 Context using the AdapTable UI
- Both can be provided via FDC3 Menu Items that appear in the **Context Menu**
- Or they can be available using **FDC3 Action Columns** which can be:
  - created dynamically by AdapTable using developer-provided Button definitions
  - be full FDC3 Action Column definitions - supplied by developers

AdapTable makes it easy for developers to configure the AdapTable UI to perform FDC3-related actions.

These FDC3-related actions will most typically be to:

- [Raise FDC3 Intents](https://www.adaptabletools.com/docs/handbook-fdc3-intents/index.md)
- [Broadcast FDC3 Context](https://www.adaptabletools.com/docs/handbook-fdc3-context/index.md)

In particular 2 areas of UI Components are available:

- Context Menu
- FDC3 Action Columns

## Context Menu Items

AdapTable leverages the [Context Menu](https://www.adaptabletools.com/docs/ui-context-menu/index.md) to make it easy for users to raise Intents or broadcast Context.

```tsx {6,7,8,17,18,19}
intents: {
  raises: {
    ViewResearch: [
      {
        contextType: 'fdc3.instrument',
        contextMenu: {
          columnIds: ['instrument', 'counterparty'],
          icon: '_defaultFdc3',
        },
      },
    ],
  }
},
contexts: {
  broadcasts: {
    'fdc3.currency': {
      contextMenu: {
        columnIds: ['currency'],
        icon: '_defaultFdc3',
      },
    },
  }
},
```

## FDC3 Action Columns

AdapTable makes it easy for developers to provide dedicated Buttons to perform FDC3-related actions.

Developers can provide buttons in one 2 ways:

- as standard [Adaptable Button](https://www.adaptabletools.com/docs/ui-tutorial-displaying-adaptable-buttons/index.md) definitions (and AdapTable creates the Action Column)
- inside a bespoke [Action Column](https://www.adaptabletools.com/docs/handbook-action-column/index.md) definition

This approach allows for as many FDC3 Action Columns as required and for full flexibility over look and feel

### FDC3 Buttons

The more straightforward approach is to define FDC3 Buttons.

These buttons are of type [`Fdc3AdaptableButton`](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md) - a specialist, reduced form of the standard [Adaptable Button](https://www.adaptabletools.com/docs/ui-tutorial-displaying-adaptable-buttons/index.md) containing these poperties:

| Property | Type | Description |
| --- | --- | --- |
| [buttonStyle](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md#buttonstyle) | [`ButtonStyle`](https://www.adaptabletools.com/docs/reference/buttonstyle.md)` \| ((button: `[`Fdc3AdaptableButton`](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md)`, context: `[`Fdc3ButtonContext`](https://www.adaptabletools.com/docs/reference/fdc3buttoncontext.md)`) => `[`ButtonStyle`](https://www.adaptabletools.com/docs/reference/buttonstyle.md)`)` | Button&#39;s Style; can be object or function that provides `ButtonStyle` object |
| [disabled](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md#disabled) | `(button: `[`Fdc3AdaptableButton`](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md)`, context: `[`Fdc3ButtonContext`](https://www.adaptabletools.com/docs/reference/fdc3buttoncontext.md)`) => boolean` | Function to disable / enable button based on evaluation result |
| [hidden](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md#hidden) | `(button: `[`Fdc3AdaptableButton`](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md)`, context: `[`Fdc3ButtonContext`](https://www.adaptabletools.com/docs/reference/fdc3buttoncontext.md)`) => boolean` | Function to hide the Button |
| [icon](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md#icon) | `'_defaultFdc3' \| `[`AdaptableIcon`](https://www.adaptabletools.com/docs/reference/adaptableicon.md)` \| ((button: `[`Fdc3AdaptableButton`](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md)`, context: `[`Fdc3ButtonContext`](https://www.adaptabletools.com/docs/reference/fdc3buttoncontext.md)`) => `[`AdaptableIcon`](https://www.adaptabletools.com/docs/reference/adaptableicon.md)`)` | Button&#39;s Icon; can be object or function that provides `AdaptableIcon` object |
| [id](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md#id) | `string` | Unique id for the button |
| [label](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md#label) | `'_defaultFdc3' \| string \| ((button: `[`Fdc3AdaptableButton`](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md)`, context: `[`Fdc3ButtonContext`](https://www.adaptabletools.com/docs/reference/fdc3buttoncontext.md)`) => string)` | Button&#39;s Label; can be string or function that provides string |
| [tooltip](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md#tooltip) | `'_defaultFdc3' \| string \| ((button: `[`Fdc3AdaptableButton`](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md)`, context: `[`Fdc3ButtonContext`](https://www.adaptabletools.com/docs/reference/fdc3buttoncontext.md)`) => string)` | Button&#39;s Tooltip; can be string or function that provides string |

AdapTable will dynamically render these buttons inside an FDC3 Action Column.

The Button definition is the same for [Raising FDC3 Intents](https://www.adaptabletools.com/docs/handbook-fdc3-intents/index.md) and [Broadcasting FDC3 Context](https://www.adaptabletools.com/docs/handbook-fdc3-context/index.md)

Like all [Adaptable Buttons](https://www.adaptabletools.com/docs/ui-tutorial-displaying-adaptable-buttons/index.md), FDC3 Buttons can be provided with custom Label, Style, Icon and Tooltip.

- As a convenience, AdapTable provides [default values for Icon and Tooltip properties](#default-button-values) to be rendered as required
- These defaults themselves can be overridden by developers if required

```tsx {7,8,9,10,11,19,20,21,22}
fdc3Options: {
  intents: {
    raises: {
      ViewQuote: [
        {
          contextType: 'fdc3.instrument',
          actionButton: {
            id: 'ViewQuoteButton',
            label: 'View Quote',
            icon: '_defaultFdc3',
            tooltip: '_defaultFdc3',
          },
        },
      ],
  },
  contexts: {
    broadcasts: {
      'fdc3.currency': {
        actionButton: {
          id: 'BroadCastCurrencyButton',
          icon: '_defaultFdc3',
          tooltip: '_defaultFdc3',
        },
      },
  },
},

```

### Default FDC3 Action Column

AdapTable creates a FDC3 Action Column automatically in which to render any defined FDC3 Buttons.

The Column has the Id `fdc3ActionColumn` and can be used like any other [Action Column](https://www.adaptabletools.com/docs/handbook-action-column/index.md) in AdapTable.

If you wish this Action Column to be visible it is your responsibility to list it in the relevant [Layouts](https://www.adaptabletools.com/docs/handbook-layouts/index.md)

The Default Action Column can itself be configured by developers using the `actionColumnDefaultConfiguration` property in FDC3 Options.

### `actionColumnDefaultConfiguration`

Configures the default FDC3 Actions column

  [`ActionColumnDefaultConfiguration`](https://www.adaptabletools.com/docs/reference/actioncolumndefaultconfiguration.md)

Configuration properties to use for the default FDC3 Action Column.

This is the Action Column that is rendered by AdapTable to display any provided FDC3 Buttons.

It is of type [`ActionColumnDefaultConfiguration`](https://www.adaptabletools.com/docs/reference/actioncolumndefaultconfiguration.md) which is defined as follows:

| Property | Type | Description | Default |
| --- | --- | --- | --- |
| [columnId](https://www.adaptabletools.com/docs/reference/actioncolumndefaultconfiguration.md#columnid) | `string` | Column Id | &#39;fdc3ActionColumn&#39; |
| [headerName](https://www.adaptabletools.com/docs/reference/actioncolumndefaultconfiguration.md#headername) | `string` | Column Header | &#39;FDC3 Actions&#39; |
| [movable](https://www.adaptabletools.com/docs/reference/actioncolumndefaultconfiguration.md#movable) | `boolean` | If Column is movable | false |
| [resizable](https://www.adaptabletools.com/docs/reference/actioncolumndefaultconfiguration.md#resizable) | `boolean` | If Column is resizable | true |
| [rowScope](https://www.adaptabletools.com/docs/reference/actioncolumndefaultconfiguration.md#rowscope) | [`RowScope`](https://www.adaptabletools.com/docs/reference/rowscope.md) | Which rows button appears in | data rows only |
| [width](https://www.adaptabletools.com/docs/reference/actioncolumndefaultconfiguration.md#width) | `number` | Column Width in pixels | 200 |

```tsx {1}
actionColumnDefaultConfiguration: {
  columnId: 'customFdc3MainActionColumn',
  width: 250,
}
```

### Full FDC3 Action Columns

Instead of providing a set of FDC3 Buttons, developers can define a **full** FDC3 Action Column.

- This allows for greater configurablity and flexibililty of the Action Column
- It also allows for more than one Action Column to be visible in the Grid

The Action Column is of type [`FDC3ActionColumn`](https://www.adaptabletools.com/docs/reference/fdc3actioncolumn.md) - a specialist, reduced form of the standard [Action Column](https://www.adaptabletools.com/docs/handbook-action-column/index.md) and contains these poperties:

| Property | Type | Description |
| --- | --- | --- |
| [button](https://www.adaptabletools.com/docs/reference/fdc3actioncolumn.md#button) | [`Fdc3AdaptableButton`](https://www.adaptabletools.com/docs/reference/fdc3adaptablebutton.md) | FDC3 Button to display |
| [columnId](https://www.adaptabletools.com/docs/reference/fdc3actioncolumn.md#columnid) | `string` | Id of the Column |
| [defaultWidth](https://www.adaptabletools.com/docs/reference/fdc3actioncolumn.md#defaultwidth) | `number` | Default Width of column |
| [friendlyName](https://www.adaptabletools.com/docs/reference/fdc3actioncolumn.md#friendlyname) | `string` | Column&#39;s friendly name |

- Similar to FDC3 Buttons, AdapTable provides [default Icon and Tooltip values](#default-button-values) for FDC3 Action Column Buttons
- These defaults themselves can be overridden by developers if required

All defined Action Columns should be included in any relevant [Layouts definitions](https://www.adaptabletools.com/docs/handbook-layouts/index.md)

```tsx {6,7,8,9,10,11,12,13,22,23,24,25,26,27,28}
fdc3Options: {
  intents: {
    raises: {
      ViewInstrument: [
        {
          actionColumn: {
            columnId: 'fdc3ViewInstrumentColumn',
            friendlyName: 'FDC3: ViewInstrument',
            button: {
              id: 'ViewInstrumentButton',
              label: '_defaultFdc3',
              tooltip: '_defaultFdc3',
              icon: '_defaultFdc3',
            },
          },
        },
      ],
  },
  contexts: {
    broadcasts: {
      'fdc3.currency': {
        actionColumn: {
          columnId: 'currency_column',
          friendlyName: 'Currency Column',
          button: {
            id: 'CurrencyButton',
            label: 'Announce Currency',
            icon: '_defaultFdc3',
          }
        },
      },
    },
  },
},
```

## Default UI Property Values

As a helpful aid to developers, AdapTable provides a special `_defaultFdc3` value.

It is available when defining both FDC3 Ui Components - Context Menus and FDC3 Action Columns.

When used, AdapTable will automatically supply the real values using sensible defaults

The `_defaultFdc3` can be supplied for 2 properties (in both Context Menus and Action Columns):

- `Icon` - AdapTable displays an appropriate Icon (for the Intent or the Context)
- `Tooltip` - AdapTable renders relevant Tooltip text

### AdapTable Default Icons

AdapTable provides a different default Icon to use for each Context and Intent.

These are used by AdapTable when the `_defaultFdc3` value is given for an Icon property.

### List of Default Icons

The default Icons used by AdapTable when the `_defaultFdc3` value is given are:

**FDC3 Contexts**

| FDC3 Context                                                                 | Default Icon                             | Icon Name    |
| ---------------------------------------------------------------------------- | ---------------------------------------- | ------------ |
| [Chart](https://fdc3.finos.org/docs/context/ref/Chart)                       |     | pie-chart    |
| [ChatInitSettings](https://fdc3.finos.org/docs/context/ref/ChatInitSettings) |          | chat         |
| [Contact](https://fdc3.finos.org/docs/context/ref/Contact)                   |         | badge        |
| [ContactList](https://fdc3.finos.org/docs/context/ref/ContactList)           |         | badge        |
| [Country](https://fdc3.finos.org/docs/context/ref/Country)                   |          | flag         |
| [Currency](https://fdc3.finos.org/docs/context/ref/Currency)                 |        | dollar       |
| [Email](https://fdc3.finos.org/docs/context/ref/Chart)                       |          | mail         |
| [Instrument](https://fdc3.finos.org/docs/context/ref/Instrument)             |         | money        |
| [InstrumentList](https://fdc3.finos.org/docs/context/ref/InstrumentList)     |         | money        |
| [Organization](https://fdc3.finos.org/docs/context/ref/Organization)         |  | organisation |
| [Portfolio](https://fdc3.finos.org/docs/context/ref/Portfolio)               |      | building     |
| [Position](https://fdc3.finos.org/docs/context/ref/Position)                 |      | building     |
| [TimeRange](https://fdc3.finos.org/docs/context/ref/TimeRange)               |    | date-range   |
| [Valuation](https://fdc3.finos.org/docs/context/ref/Valuation)               |      | equation     |

**FDC3 Intents**

| FDC3 Intent                                                                  | Default Icon                             | Icon Name    |
| ---------------------------------------------------------------------------- | ---------------------------------------- | ------------ |
| [StartCall](https://fdc3.finos.org/docs/intents/ref/StartCall)               |          | call         |
| [StartChat](https://fdc3.finos.org/docs/intents/ref/StartChat)               |          | chat         |
| [StartEmail](https://fdc3.finos.org/docs/intents/ref/StartEmail)             |          | mail         |
| [ViewAnalysis](https://fdc3.finos.org/docs/intents/ref/ViewAnalysis)         |    | spark-line   |
| [ViewChart](https://fdc3.finos.org/docs/intents/ref/ViewChart)               |     | pie-chart    |
| [ViewContact](https://fdc3.finos.org/docs/intents/ref/ViewContact)           |        | person       |
| [ViewHoldings](https://fdc3.finos.org/docs/intents/ref/ViewHoldings)         |      | building     |
| [ViewInstrument](https://fdc3.finos.org/docs/intents/ref/ViewInstrument)     |         | money        |
| [ViewInteractions](https://fdc3.finos.org/docs/intents/ref/ViewInteractions) |  | interactions |
| [ViewNews](https://fdc3.finos.org/docs/intents/ref/ViewNews)                 |          | news         |
| [ViewOrders](https://fdc3.finos.org/docs/intents/ref/ViewOrders)             |         | order        |
| [ViewProfile](https://fdc3.finos.org/docs/intents/ref/ViewProfile)           |         | badge        |
| [ViewQuote](https://fdc3.finos.org/docs/intents/ref/ViewQuote)               |         | quote        |
| [ViewResearch](https://fdc3.finos.org/docs/intents/ref/ViewResearch)         |       | science      |

### User Default Icons

If the AdapTable Default FDC3 Icons are not suitable, Developers can provide their own **Default Icons**.

If provided, these developer-supplied icons will be used, in preference to the standard AdapTable defaults, whenever the `_defaultFdc3` value is given for an Icon property.

The order of evaluation is:

- no value provided - nothing is shown
- `_defaultFdc3` (and no override) - AdapTable's default value is used
- `_defaultFdc3` overridden - the default provided by the developer is used
- property is explicitly set - this value is used
