@relax.js/docking
v0.2.0
Published
Native Web Components for docked app layouts: resizable split panes, a closable and draggable tab strip, an editor area of splittable tab groups, and an IDE-style workbench.
Maintainers
Readme
@relax.js/docking
Native Web Components for apps laid out the way code editors are: panes the user resizes, tabs they close and drag, an editor area they split, and side bars and a panel they dock views into.

They are made for Relax.js apps and look like @relax.js/components, but every one is a plain custom element.
| Element | What it is |
|---------|------------|
| r-split | Panes side by side or stacked, divided by draggable, keyboard-operable dividers |
| r-tab-strip | Tab headers without panels: closable, draggable, with icons, counts and an unsaved-changes dot |
| r-editor-grid | Tab groups split side by side or stacked, with tabs dragged between groups or onto an edge to split |
| r-workbench | An app frame: title bar, activity rail, editor area, two side bars, a bottom panel and a status bar, with views docked by dragging |
Each element keeps its layout as plain data (layout) and reports every change the user makes with an event carrying the whole layout, so an app keeps it and hands it back on the next start.
Demos
Three small apps show the elements in the kinds of app they are made for: a code editor, a mail client and a log console. Clone the repository and run npm install and npm run demo; demo/README.md has the rest.
| Code editor | Mail client | Log console |
|-------------|-------------|-------------|
|
|
|
|
Install
npm install @relax.js/docking @relax.js/components @relax.js/coreimport '@relax.js/docking';@import "@relax.js/components/theme.css";Importing the package registers every tag. One element alone is import '@relax.js/docking/split', and the same for tab-strip, editor-grid and workbench. The elements take their colours, spacing and shape from the components' theme, so a page built from both looks like one product; see Customizing.
Words
The words the elements write (accessible names, button titles, region names) come from the Relax.js i18n namespace r-docking. English and Swedish ship with the package; an app rewords them by registering its own r-docking namespace.
Failures
A wrong attribute value is reported through the Relax.js error channel as <tag>: <what is wrong>, never thrown, so it reaches onError(), window.relaxErrors and captureRelaxErrors(). A method given an id the element does not hold throws an error naming the element.
License
MIT
