Dockable
API reference

IJsonModel

The JSON format of a layout - global, row, tabset and tab attributes.

A layout is an IJsonModel (FlexLayout's format). Model.fromJson(json) reads it and model.toJson() writes it. The attribute tables below are generated from the JSDoc in packages/core/src/model/IJsonModel.ts.

interface IJsonModel {
    global?: IGlobalAttributes;
    borders?: IJsonBorderNode[];
    layout: IJsonRowNode; // the root row
    subLayouts?: Record<string, IJsonSubLayout>; // popout windows
}
{
    "global": { "tabEnableClose": false, "tabSetMinWidth": 120 },
    "layout": {
        "type": "row",
        "children": [
            { "type": "tabset", "weight": 70, "children": [{ "type": "tab", "id": "editor", "name": "Editor", "component": "editor" }] },
            {
                "type": "row",
                "weight": 30,
                "children": [
                    { "type": "tabset", "children": [{ "type": "tab", "name": "Outline", "component": "outline" }] },
                    { "type": "tabset", "children": [{ "type": "tab", "name": "Console", "component": "console", "config": { "lines": 200 } }] }
                ]
            }
        ]
    }
}

The top-level row is horizontal (unless rootOrientationVertical); a row inside a row takes the opposite orientation, so it acts as a column.

Which attributes Dockable acts on

The model keeps every FlexLayout attribute, but the headless primitives render no chrome, so attributes that describe FlexLayout's built-in view are data for your own rendering: the model stores them and returns them from getters (tab.getIcon(), tab.getHelpText(), tabset.getTabLocation(), tabset.isEnableTabWrap(), …), and your recursion decides what to do with them. That includes className, contentClassName, classNameTabStrip, icon, helpText, altName, closeType, tabLocation, enableTabStrip, enableTabWrap, enableTabScrollbar, enableActiveIcon, enableCloseButton, enableSingleTabStretch, enablePopoutIcon, enableFloatIcon and enableRename.

The engine and the primitives do act on: weight, the min/max sizes, selected, active, maximized, enableDrag, enableDrop, enableDivide, enableClose (the close key), enableDeleteWhenEmpty, enableMaximize (the model refuses to maximize), autoSelectTab, pinned, enablePopout, enableRenderOnDemand, enableScrollbars, enableWindowReMount, enableEdgeDock and rootOrientationVertical.

Border attributes (borders, border* globals) apply to the borders Dockable.Borders renders (see Borders); borderEnableTabScrollbar and tab groups inside borders do not render yet. Float, group and sub-layout-in-tab attributes are read and saved, but floats and tab groups are not rendered yet (see Limitations).

Inheritance

Many tab and tabset attributes have a global counterpart: tabEnableClose is the default of every tab's enableClose, tabSetMinWidth of every tabset's minWidth. A node's own value wins. The defaults below say "(global …)" when they come from one.

Tabset JSON

IJsonTabSetNode adds, on top of the attributes below:

fieldtypedescription
activebooleanmarks this as the active tab set, read from initial json but must subsequently be set on the model (only one tab set can be active)
maximizedbooleanmarks this tab set as being maximized, read from initial json but must subsequently be set on the model (only one tab set can be maximized)
childrenIJsonTabNode[]its tabs

Global attributes

IGlobalAttributes, under global. Change them at runtime with Actions.updateModelAttributes.

attributetypedefaultdescription
borderAutoSelectTabWhenClosedbooleanfalsewhether to select new/moved tabs in border when the border is currently closed
borderAutoSelectTabWhenOpenbooleantruewhether to select new/moved tabs in border when the border is already open
borderClassNamestringnoneclass applied to the border container
borderEnableAutoHidebooleanfalsehide border if it has zero tabs; not related to the borderType 'overlay' mode (Visual Studio style auto hide), see the borderType attribute
borderEnableDropbooleantruewhether tabs can be dropped into this border
borderEnableTabScrollbarbooleanfalsewhether to show a mini scrollbar for the tabs
borderLeftTabDirectionIBorderTabDirection"up"the direction the left border tabs read: 'up' (default, text reads bottom to top) or 'down' (text reads top to bottom like the right border)
borderMaxSizenumber99999the maximum size of the tab area
borderMinSizenumber1the minimum size of the tab area
borderSizenumber200size of the tab area when selected
enableEdgeDockbooleantrueenable docking to the edges of the layout
enableEdgeDockIndicatorsbooleantrueshow the edge indicators when dragging
edgeDockMarginnumber10the depth in px of the band along each layout edge where a drop docks to that edge (a Dockable addition: FlexLayout hard-codes 10); lower it when a tab strip sits at the top edge
edgeDockLengthnumber100the length in px of each edge's drop band, centred on the edge, while enableEdgeDockIndicators is on (the whole edge otherwise); a Dockable addition: FlexLayout hard-codes 100
enableRotateBorderIconsbooleantrueboolean indicating if tab icons should rotate with the text in the left and right borders
rootOrientationVerticalbooleanfalsethe top level 'row' will layout horizontally by default, set this option true to make it layout vertically
tabBorderHeightnumber-1the height of this tab when shown in a border; -1 uses the border's default size
tabBorderWidthnumber-1the width of this tab when shown in a border; -1 uses the border's default size
tabClassNamestringnoneclass applied to tab button
tabCloseTypeICloseType1when the tab's close button is active: Visible (default) active if selected or hovered (note: mobile doesnt support hovered), Always: always active, Selected only active on selected tab (clicking on the x button on a non-selected tab will just select it)
tabContentClassNamestringnoneclass applied to tab content
tabEnableClosebooleantruewhether the tab can be closed by the user via its close button
tabEnableDragbooleantruewhether the user can drag the tab to a new location
tabEnableFloatbooleanfalsewhether the user can move the tab to a floating window via the context menu
tabEnableFloatIconbooleanfalsewhether to show the float icon in the tabset header if this tab enables floating
tabEnablePinbooleanfalsewhether the user can pin/unpin the tab via the context menu
tabEnablePopoutbooleanfalseenable window popout (in popout capable browser), to show an icon in the tabset header also set the enablePopoutIcon attribute
tabEnablePopoutIconbooleanfalsewhether to show the popout icon in the tabset header if this tab enables popouts
tabEnablePopoutOverlaybooleanfalseif this tab will not work correctly in a popout window when the main window is backgrounded (inactive) then enabling this option will gray out this tab
tabEnableRenamebooleanfalsewhether the user can rename the tab by double clicking
tabEnableRenderOnDemandbooleantruewhether to avoid rendering component until tab is visible
tabEnableScrollbarsbooleantruewhether the tab will be hosted in a scrollable container
tabGroupTypeITabGroupType"splitpill"how a tab group is visually indicated: 'splitpill' encloses the group's tabs in a pill (left/right caps), 'underline' draws a colored underline under each grouped tab
tabIconstringnonethe tab icon
tabMaxHeightnumber99999the maximum height (in px) of this tab
tabMaxWidthnumber99999the maximum width (in px) of this tab
tabMinHeightnumber1the minimum height (in px) of this tab
tabMinWidthnumber1the minimum width (in px) of this tab
tabSetAutoSelectTabbooleantruewhether to select new/moved tabs in tabset
tabSetClassNameTabStripstringnonea class name to apply to the tab strip
tabSetEnableActiveIconbooleanfalsewhether the active icon (*) should be displayed when the tabset is active
tabSetEnableClosebooleantruewhether this tabset can be closed
tabSetEnableCloseButtonbooleanfalseif the tabset can be closed then show a close button
tabSetEnableDeleteWhenEmptybooleantruewhether to delete this tabset when it has no tabs
tabSetEnableDividebooleantruewhether dropping on an edge of this tabset splits it to create a new tabset
tabSetEnableDragbooleantruewhether the user can drag tabs out of this tabset
tabSetEnableDropbooleantruewhether tabs can be dropped into this tabset
tabSetEnableMaximizebooleantruewhether the tabset can be maximized to fill the layout via the maximize button
tabSetEnableSingleTabStretchbooleanfalseif the tabset has only a single tab then stretch the single tab to fill area and display in a header style
tabSetEnableTabGroupsbooleanfalsewhether the tab group options are enabled in the context menu (default menus)
tabSetEnableTabScrollbarbooleanfalsewhether to show a mini scrollbar for the tabs
tabSetEnableTabStripbooleantruewhen enabled the tabset shows a tab strip and can host multiple tabs; when disabled the strip is hidden
tabSetEnableTabWrapbooleanfalsewrap tabs onto multiple lines
tabSetMaxHeightnumber99999maximum height (in px) for this tabset
tabSetMaxWidthnumber99999maximum width (in px) for this tabset
tabSetMinHeightnumber1minimum height (in px) for this tabset
tabSetMinWidthnumber1minimum width (in px) for this tabset
tabSetTabLocationITabLocation"top"the location of the tabs either top or bottom

Row attributes

IRowAttributes (IJsonRowNode adds children).

attributetypedefaultdescription
idstringnonethe unique id of the row, if left undefined a uuid will be assigned
typestringnoneFixed value: "row"
weightnumber100relative weight for sizing of this row in parent row

Tabset attributes

ITabSetAttributes. Change them at runtime with Actions.updateNodeAttributes(tabsetId, …).

attributetypedefaultdescription
autoSelectTabbooleantrue (global tabSetAutoSelectTab)whether to select new/moved tabs in tabset
classNameTabStripstringundefined (global tabSetClassNameTabStrip)a class name to apply to the tab strip
configanynonea place to hold json config used in your own code
enableActiveIconbooleanfalse (global tabSetEnableActiveIcon)whether the active icon (*) should be displayed when the tabset is active
enableClosebooleantrue (global tabSetEnableClose)whether this tabset can be closed
enableCloseButtonbooleanfalse (global tabSetEnableCloseButton)if the tabset can be closed then show a close button
enableDeleteWhenEmptybooleantrue (global tabSetEnableDeleteWhenEmpty)whether to delete this tabset when it has no tabs
enableDividebooleantrue (global tabSetEnableDivide)whether dropping on an edge of this tabset splits it to create a new tabset
enableDragbooleantrue (global tabSetEnableDrag)whether the user can drag tabs out of this tabset
enableDropbooleantrue (global tabSetEnableDrop)whether tabs can be dropped into this tabset
enableMaximizebooleantrue (global tabSetEnableMaximize)whether the tabset can be maximized to fill the layout via the maximize button
enableSingleTabStretchbooleanfalse (global tabSetEnableSingleTabStretch)if the tabset has only a single tab then stretch the single tab to fill area and display in a header style
enableTabGroupsbooleanfalse (global tabSetEnableTabGroups)whether the tab group options are enabled in the context menu (default menus)
enableTabScrollbarbooleanfalse (global tabSetEnableTabScrollbar)whether to show a mini scrollbar for the tabs
enableTabStripbooleantrue (global tabSetEnableTabStrip)when enabled the tabset shows a tab strip and can host multiple tabs; when disabled the strip is hidden
enableTabWrapbooleanfalse (global tabSetEnableTabWrap)wrap tabs onto multiple lines
idstringnonethe unique id of the tab set, if left undefined a uuid will be assigned
maxHeightnumber99999 (global tabSetMaxHeight)maximum height (in px) for this tabset
maxWidthnumber99999 (global tabSetMaxWidth)maximum width (in px) for this tabset
minHeightnumber1 (global tabSetMinHeight)minimum height (in px) for this tabset
minWidthnumber1 (global tabSetMinWidth)minimum width (in px) for this tabset
namestringnonean accessible label for the tab strip (used as the tablist's aria-label; not displayed visually)
selectednumber0index of selected/visible tab in tabset; -1 means no tab selected
tabLocationITabLocation"top" (global tabSetTabLocation)the location of the tabs either top or bottom
typestringnoneFixed value: "tabset"
weightnumber100relative weight for sizing of this tabset in parent row

Tab attributes

ITabAttributes (IJsonTabNode). Change them at runtime with Actions.updateNodeAttributes(tabId, …).

attributetypedefaultdescription
altNamestringnonethe name used in the overflow menu when the tab has no name (e.g. an icon-only tab)
borderHeightnumber-1 (global tabBorderHeight)the height of this tab when shown in a border; -1 uses the border's default size
borderWidthnumber-1 (global tabBorderWidth)the width of this tab when shown in a border; -1 uses the border's default size
classNamestringundefined (global tabClassName)class applied to tab button
closeTypeICloseType1 (global tabCloseType)when the tab's close button is active: Visible (default) active if selected or hovered (note: mobile doesnt support hovered), Always: always active, Selected only active on selected tab (clicking on the x button on a non-selected tab will just select it)
componentstringnonestring identifying which component to render in this tab (used in the layout factory function)
configanynonea place to hold json config for the hosted component
contentClassNamestringundefined (global tabContentClassName)class applied to tab content
enableClosebooleantrue (global tabEnableClose)whether the tab can be closed by the user via its close button
enableDragbooleantrue (global tabEnableDrag)whether the user can drag the tab to a new location
enableFloatbooleanfalse (global tabEnableFloat)whether the user can move the tab to a floating window via the context menu
enableFloatIconbooleanfalse (global tabEnableFloatIcon)whether to show the float icon in the tabset header if this tab enables floating
enablePinbooleanfalse (global tabEnablePin)whether the user can pin/unpin the tab via the context menu
enablePopoutbooleanfalse (global tabEnablePopout)enable window popout (in popout capable browser), to show an icon in the tabset header also set the enablePopoutIcon attribute
enablePopoutIconbooleanfalse (global tabEnablePopoutIcon)whether to show the popout icon in the tabset header if this tab enables popouts
enablePopoutOverlaybooleanfalse (global tabEnablePopoutOverlay)if this tab will not work correctly in a popout window when the main window is backgrounded (inactive) then enabling this option will gray out this tab
enableRenamebooleanfalse (global tabEnableRename)whether the user can rename the tab by double clicking
enableRenderOnDemandbooleantrue (global tabEnableRenderOnDemand)whether to avoid rendering component until tab is visible
enableScrollbarsbooleantrue (global tabEnableScrollbars)whether the tab will be hosted in a scrollable container
enableWindowReMountbooleanfalseif enabled the tab will re-mount when popped out/in
helpTextstringnonehelp text for the tab to be displayed upon tab hover
iconstringundefined (global tabIcon)the tab icon
idstringnonethe unique id of the tab, if left undefined a uuid will be assigned
maxHeightnumber99999 (global tabMaxHeight)the maximum height (in px) of this tab
maxWidthnumber99999 (global tabMaxWidth)the maximum width (in px) of this tab
minHeightnumber1 (global tabMinHeight)the minimum height (in px) of this tab
minWidthnumber1 (global tabMinWidth)the minimum width (in px) of this tab
namestring""name of tab to be displayed in the tab button
pinnedbooleanfalsewhether the tab is pinned; pinned tabs are grouped at the start of the tabstrip, cannot be closed via the ui, and cannot be dragged out of their tabset (they can be reordered within the pinned group). Set via Actions.setTabPinned. Only applies to tabs in tabsets (not borders); pinned tabs should be listed first in the json
subLayoutIdstringnonethe Id of the sub layout to render in this tab, defined in the subLayouts section of the model json (if component is also defined then use the <TabLayout> component in the factory to render the sublayout)
tabsetClassNamestringnoneclass applied to parent tabset when this is the only tab and it is stretched to fill the tabset
typestringnoneFixed value: "tab"

Sub-layout attributes

IJsonSubLayout (an entry of subLayouts, i.e. a popout window) has layout (its root row), rect ({ x, y, width, height }, the window's screen rect), type ("window", "float" or "tab") and:

attributetypedefaultdescription
namestringnonethe name of the sub layout, e.g. as shown in the model explorer

On this page