Skip to content

Layout & Constraints ​

1. Declarative Zone Layout Schema (RedDokiaZoneLayoutSchema) ​

Declare the central document stage (contents), 6 outer EdgeBar slots (leftTopEdgeBar, leftBottomEdgeBar, rightTopEdgeBar, rightBottomEdgeBar, bottomLeftEdgeBar, bottomRightEdgeBar), topBar, and statusBar with RedDokiaZoneLayoutSchema.

ts
import type { RedDokiaLayoutSchema } from 'reddokia';

export const layoutSchema: RedDokiaLayoutSchema = {
  topBar: { logoText: 'RD', title: 'Studio' },
  statusBar: true,
  leftTopEdgeBar: {
    children: ['explorer'],
    size: 260,
    minSize: 180,
    maxSize: 420,
    snap: true,
  },
  contents: ['editor-1', 'editor-2'],
  bottomLeftEdgeBar: {
    children: ['console'],
    size: 160,
    minSize: 100,
  },
  rightTopEdgeBar: {
    children: ['inspector'],
    size: 280,
    collapsed: true,
  },
};

3-Level Authoring Shorthand ​

Inside contents and any split node's children, you can mix three shorthand levels depending on your needs:

LevelSyntaxExample & Purpose
1. View ID Array (string[])['view-a', 'view-b']Shortest way to declare a single tab group (first view starts active)
2. Group Schema (RedDokiaGroupSchema){ children: ['a', 'b'], activeViewId: 'b', minSize: 200, locked: true }Configure initial active tab, size bounds, chromeless header (showHeader: false), or locked state
3. Split Tree (RedDokiaSplitSchema){ type: 'col', children: [['top'], ['bottom']] }Nest horizontal ('row', default) or vertical ('col') splits to any depth

RedDokiaViewSchema DX Conveniences

  • Auto-Formatted title: Omitting title in views automatically formats id ('scene-inspector' → 'Scene Inspector').
  • Flexible icon Values: Pass built-in RedDokiaIcons.* constants, image/SVG URLs ('/favicon.svg', './logo.png', data:image/...), raw <svg> markup, or framework icon components.

2. Size Constraints (Flat Schema Properties) ​

Declare size constraints directly as top-level properties on any group (RedDokiaGroupSchema), split (RedDokiaSplitSchema), EdgeBar slot (RedDokiaEdgeBarSchema), or view (RedDokiaViewSchema). The engine compiles them into normalized RedDokiaNodeConstraints at runtime.

PropertyTypeDescription
sizenumberRelative flex share among siblings (or pixel size for fixed groups and EdgeBar slots)
minSize / maxSizenumberMin/max pixels along the parent split axis
minWidth / maxWidthnumberHorizontal-axis min/max pixels
minHeight / maxHeightnumberVertical-axis min/max pixels
fixedbooleanLocks pixel size, blocks sash dragging, and preserves width across window resizes
snapbooleanAuto-collapses the pane when dragged past half of its minimum size

Sash Double-Click Equalize

Double-clicking any split sash immediately equalizes its two adjacent panes to 50:50.

3. Protected Groups (emptyContents · showHeader · locked) ​

  • emptyContents: Keeps the contents group mounted and displays a custom welcome screen when all tabs close.
  • showHeader: false: Hides the tab bar for chromeless viewports (toggleable at runtime via controller.setGroupOptions(groupId, { showHeader })).
  • locked: true: Blocks external tab drops, splits, and tab closing on the group (toggleable at runtime via controller.toggleLockGroup(groupId)).