#Dashboard
The dashboard is the chrome around the grid: bars of small widgets — view picker, quick search, buttons, row count, your own components — that give users quick access to Adaptable features.
There are four dashboards, one per side of the grid: top, bottom, left
and right. Each is configured in the dashboard slice of the Adaptable state,
and each is optional — a position without widgets renders nothing.
dashboard: {
top: {
widgets: [
{ id: 'view', type: 'view' },
{ id: 'quickSearch', type: 'quickSearch', align: 'center' },
],
},
bottom: {
widgets: [{ id: 'row-count', type: 'row-count' }],
},
},Every widget needs a unique id and a type. Some types take a value with
their configuration (the button's label and handler, the ribbon's tabs, …).
The top bar shows the application name, the view picker, quick search (centered) and the dashboard settings button (at the end). The bottom bar shows the row count and a cell summary — select a few salary cells to see their sum.
#Positions, bars and drawers
top and bottom dashboards lay their widgets out horizontally; left and
right lay them out vertically, so widgets there are more compact — usually just
an icon button that opens the matching settings page.
Each dashboard has two parts:
- the bar — the always-visible strip of widgets;
- the drawer — an area next to the bar that opens when the user clicks a tab of the ribbon, showing that tab's widgets with more room.
Within the bar, align places a widget in the start (default), center or
end section.
A dashboard section also accepts:
disableResize— stops users from resizing the drawer by dragging its edge;hidden— hides the dashboard but keeps its widgets and style, so it can be shown again as it was;size—baranddrawersizes in pixels (the height fortop/bottom, the width forleft/right);style— colors for the bar (bar.background,bar.color,bar.buttonColor) and the ribbon tabs (tabs.background).
#Widget types
General widgets:
| Type | Shows |
|---|---|
application-name | The config.applicationName from state |
row-count | The number of rows (after filtering); in server mode, the count the server sends |
selected-row-count | The number of selected rows, from rowSelectionApi.getSelectedRowCount() |
grid-filter | The current view's grid filter expression |
column-chooser | Pick and reorder the view's columns (compact in bars, full in a vertical drawer) |
button | A button — see Buttons and info |
info | Custom text or content |
ribbon | A strip of tabs that open the drawer — see Ribbon tabs |
custom | A widget from dashboard.customWidgets — see Custom widgets |
custom-content | Inline custom content |
Module widgets — one per Adaptable module. In a bar they show a button that
opens the module's settings page — next to the control itself for view,
quickSearch, theme and export in horizontal bars (cell-summary shows its
value in every bar). In a drawer they show the full control:
| Type | Shows |
|---|---|
view | The view picker |
quickSearch | The quick search input |
theme | The theme picker |
export | The report picker, with run, edit, delete and new buttons |
cell-summary | An aggregation (sum, avg, …) of the selected cells |
dashboard | Opens the dashboard settings for this position |
settingsPanel | Opens the settings panel |
styledCell, flashingCell, calculatedColumn, alert | Open the matching settings page |
The cell-summary widget needs a view with multi-cell selection. Its value is
the aggregation to show — 'sum', 'avg', 'min', 'max', 'distinct' or
'count' — or an object { fn, label, formatter, showDropdown }; users can
switch the aggregation from its dropdown.
Module widgets respect the modules prop and user permissions: a widget whose
module is excluded, or which the current user has no permissions for, is not
rendered. See Permissioning.
#Ribbon tabs
The ribbon widget works like the Microsoft Office ribbon: it adds a row of tab
names to the bar, and clicking a tab opens the drawer with that tab's widgets.
Clicking the open tab again closes the drawer.
{
id: 'ribbon',
type: 'ribbon',
value: {
openTabName: 'Views', // the tab open initially — omit to start closed
tabs: [
{
name: 'Views',
widgets: [{ id: 'view', type: 'view' }, { id: 'theme', type: 'theme' }],
},
{ name: 'Export', widgets: [{ id: 'export', type: 'export' }] },
],
},
};Each dashboard has at most one ribbon (only the first ribbon widget in a bar
is used), and only one of its tabs is open at a time. The open tab is part of
the state, so it persists like everything else.
The top ribbon has a Views tab (view and theme pickers) and an Export tab. The right ribbon opens a column chooser — the full list of columns fits in a vertical drawer. Click a tab to close or open its drawer, and drag the drawer edge to resize it.
#Buttons and info
The button widget renders a button. Its value takes:
label— text or a vnode (built withh()fromvue), or a function returning one;onClick— called with the widget props (see below), so the handler has the Adaptable API and the dashboard position at hand;tone—'success','error','warning','info','accent','default','neutral'or'none';variant—'text','outlined'or'contained'.
The info widget shows its value — a string or a vnode. Both widgets
follow the orientation of their dashboard: horizontal at the top and bottom,
vertical on the sides.
#Custom widgets
Render your own components in the dashboard in one of two ways:
- Reusable — register them in
dashboard.customWidgets(a component, a function of the widget props that returns vnodes, or a vnode, by key) and place them with acustomwidget whosevalueis that key. The same custom widget can be placed in several positions. - Inline — a
custom-contentwidget whosevalueis a vnode (built withh()fromvue) or a function of the widget props that returns one.
dashboard: {
customWidgets: {
'current-view': CurrentViewBadge, // a component, or (props: WidgetProps) => VNodeChild
},
top: {
widgets: [
{ id: 'badge', type: 'custom', value: 'current-view' },
{ id: 'hello', type: 'custom-content', value: h('b', 'Hello') },
],
},
},Custom widgets receive WidgetProps (exported from the package):
type WidgetProps = {
api: AdaptableApi; // the Adaptable API
section: DashboardSection; // the dashboard's config
sectionPosition: 'top' | 'bottom' | 'left' | 'right';
location: 'dashboard-bar' | 'dashboard-drawer';
orientation: 'horizontal' | 'vertical';
widgetId: string;
widgetType: string;
};Because they render inside the Adaptable.Provider, custom widgets can also use
the Adaptable composables, such as useAdaptableState or useAdaptableApi.
A widget that calls a composable is a component — a .vue file, or
defineWidget(name, setup) in a .ts file:
<script setup lang="ts">
import { useAdaptableState, widgetProps } from '@adaptabletools/datagrid-vue';
// a reusable widget: a component that declares the widget props
const props = defineProps(widgetProps);
const viewId = useAdaptableState((state) => state.view.currentViewId);
</script>
<template>
<span
:style="{
padding: '2px 8px',
borderRadius: '4px',
background: 'color-mix(in srgb, currentColor 12%, transparent)',
writingMode: props.orientation === 'vertical' ? 'vertical-rl' : undefined,
}"
>
View: <b>{{ viewId }}</b>
</span>
</template>The widget props are passed to a component like any other props. Declare them
with widgetProps (exported from the package), as above: by Vue's rules, a
prop the component does not declare becomes an attribute of its root element.
A function gets all of them as its argument, and nothing falls through.
CurrentViewBadge is registered once in customWidgets and placed in the top
and left dashboards — it reads the orientation from its props to lay itself out
vertically on the side. The bottom bar holds an inline custom-content widget.
Switch views to see the badge update.
#Editing the dashboard
The Dashboard page of the settings panel lets users lay out all four dashboards: a map of the positions around the grid to pick one and show or hide it, and for the selected position:
- Widgets — drag widgets into the start, center or end of the bar;
- Ribbon — add the ribbon, create tabs and drag widgets into them;
- Style — the bar and tab colors.
A position can also be removed entirely, discarding its widgets, tabs and style.
Users can add the module widgets, row-count, selected-row-count,
application-name and the ribbon
to a bar, and the module widgets and column-chooser to ribbon tabs. Everything
else — buttons, info, custom widgets — is placed by developers: users can move
those widgets around but not remove them.
The same editor is available standalone as Adaptable.UI.DashboardManager, and
the dashboard widget opens it on its own position.
#Placing the dashboards yourself
<Adaptable.UI /> renders the four dashboards around the grid for you. For a
custom layout, render the pieces yourself inside the Adaptable.Provider:
<Adaptable.Provider v-bind="props">
<!-- the four dashboards around the grid -->
<Adaptable.UI.Dashboard>
<Adaptable.UI.DataGrid />
</Adaptable.UI.Dashboard>
<!-- settings dialog, notifications and cell notes -->
<Adaptable.UI.Overlays />
</Adaptable.Provider>Adaptable.UI.Dashboard.Top, .Bottom, .Left and .Right render a single
dashboard, so you can place one anywhere in your app — pass :slots="false" to
Adaptable.UI.Dashboard to render only its default slot in the grid area.
#Dashboard API
adaptableApi.dashboardApi changes the dashboards at runtime:
const { dashboardApi } = adaptableApi;
dashboardApi.setDashboardBarWidgets('bottom', [{ id: 'row-count', type: 'row-count' }]);
// replaces the tabs of the ribbon already in the top bar
dashboardApi.setDashboardTabs('top', [{ name: 'Views', widgets: [{ id: 'view', type: 'view' }] }]);
dashboardApi.setOpenTabName('top', 'Views'); // null closes the drawer
dashboardApi.setDashboardStyle('top', { bar: { background: '#1d4ed8', color: 'white' } });
dashboardApi.setDashboardHidden('left', true); // keeps its widgets
dashboardApi.removeDashboard('right'); // discards widgets, tabs and styleThe full dashboard state is described in the state reference.