Dockable
API reference

Dockable.Tab

A tab button (role="tab") following the APG tabs pattern with manual activation. Draggable.

"A tab button (role="tab"), following the APG tabs pattern with manual activation: arrow keys (along the tab list's orientation), Home and End move focus; click, Enter or Space selects. Enter or Space on the selected tab moves focus into its panel. Renders only its children."

<Dockable.Tab
    node={tab}
    className="px-3 data-selected:bg-palette-soft data-dragging:opacity-40"
>
    {tab.getName()}
    {tab.isCloseable() ? <CloseButton tab={tab} /> : null}
</Dockable.Tab>

Render it from a Dockable.TabList child function.

Props

TabProps extends the common primitive props.

proptypedefaultdescription
nodeTabNoderequiredthe tab to render
childrenReactNodenonethe tab button's content; the primitive renders no text of its own

State

TabState:

fieldtypedescription
selectedbooleanthe tab is its tabset's selected tab
pinnedbooleanthe tab is pinned
draggingbooleanthe tab is being dragged
popoutEnabledbooleanthe tab can be popped out into a window
overflowHiddenbooleanthe tab does not fit in its strip, so it is hidden (tab overflow)

Data attributes and ARIA

attributevalue
data-layout-paththe tab button path: /ts0/tb1
data-selectedthe selected tab
data-pinnedpinned
data-draggingbeing dragged
data-popout-enabledthe tab allows popping out, and popouts are supported
data-overflow-hiddenthe tab does not fit in its strip, so it is hidden (tab overflow); it also gets display: none
idgetTabButtonId(tab) (dockable-tabbutton-<id>)
role"tab"
aria-selectedtrue or false
aria-controlsits panel's id
aria-keyshortcutsfocusTabToggle and (when closeable) closeTab
tabIndex0 on the tab stop (the selected tab, or the first tab when none is), else -1
draggablethe tab's enableDrag

Keyboard

keydoes
Left/Right (Up/Down when vertical)focus the previous/next tab
Home / Endfocus the first/last tab
Enter, Spaceselect; on the selected tab, move focus into its panel
closeTab (Ctrl+Delete)close the tab when closeable, focusing a neighbour first
focusTabToggle (off by default)move focus into the tab's content

Behaviour

  • A click selects the tab (Actions.selectTab). In a border, a click on the selected tab closes the border's panel (the same action, which the model turns into a deselect).
  • It is the drag source for its tab (useDragNode), and the element the browser snapshots as the drag image.
  • The engine measures it (for drop hit-testing within the strip).

Tab overflow

A tab that does not fit in its strip gets display: none (structural) and data-overflow-hidden. The arrow keys still reach it: moving onto a hidden tab selects it, which brings it into the strip.

On this page