Workbench Shell & Context Menus
Live Examples
1. 6-Slot EdgeBar, TopBar, and StatusBar
text
┌───────────────────────────────────────────────────────────────────┐
│ TopBar (logo · title · menus · left / right custom slots) │
├──┬───────────────┬─────────────────────────────┬───────────────┬──┤
│LT│ leftTop │ │ rightTop │RT│
│LB│ leftBottom │ Protected Contents Stage │ rightBottom │RB│
│ ├───────────────┴─────────────────────────────┴───────────────┤ │
│BL│ bottomLeft │ bottomRight │BR│
├──┴───────────────────────────┴─────────────────────────────────┴──┤
│ StatusBar (left / right custom slots) │
└───────────────────────────────────────────────────────────────────┘- 6-Slot
EdgeBar: Pin collapsible tool panels to 6 outer rails (leftTopEdgeBar,leftBottomEdgeBar,rightTopEdgeBar,rightBottomEdgeBar,bottomLeftEdgeBar,bottomRightEdgeBar) with click-to-toggle and drag-to-move. - EdgeBar Icon Context Menu: Built-in right-click actions for Hide, Move across all 6 slots (
controller.moveViewToEdgeSlot()), Float/Pop-out, and tool window label visibility (controller.setEdgeBarLabelsVisible()). TopBar&StatusBar: Declare a plain array intopBar.menusto get a full desktop menu bar with cascading submenus (items), mnemonic underlines ('File(F)'), keyboard shortcut hints (shortcut), and callbacks (action(controller)), plusleftandrightcustom component slots on both bars.
ts
import { RedDokiaIcons, type RedDokiaLayoutSchema } from 'reddokia';
import TopBarRight from './TopBarRight';
import StatusBarRight from './StatusBarRight';
export const layoutSchema: RedDokiaLayoutSchema = {
topBar: {
logoText: 'RD',
title: 'RedDokia Studio',
menus: [
{
label: 'File(F)',
items: [
{
label: 'New Tab(N)',
icon: RedDokiaIcons.Plus,
shortcut: 'Ctrl+N',
action: (ctrl) =>
ctrl.openView(`doc-${Date.now()}`, {
templateId: 'editor',
title: 'Untitled.ts',
}),
},
{
label: 'Reset Layout',
dividerBefore: true,
action: (ctrl) => ctrl.resetLayout(),
},
],
},
{
label: 'View(V)',
items: [
{
label: 'Theme',
items: [
{ label: 'Dark', action: (ctrl) => ctrl.setTheme('dark') },
{ label: 'Light', action: (ctrl) => ctrl.setTheme('light') },
],
},
],
},
],
right: TopBarRight,
},
contents: ['editor', 'preview'],
statusBar: {
right: StatusBarRight,
},
};2. Custom Group Header Actions (groupActions)
Set global header buttons via groupActions, or override per active tab with viewSchema.groupActions (inherited by templateId clones).
tsx
const views = [
{ id: 'global-actions-tab', title: 'Global Actions', component: Panel },
{
id: 'per-view-actions-tab',
title: 'Per-View Actions',
groupActions: PerViewActions, // Swaps header actions automatically when active
component: Panel,
},
];
<RedDokia views={views} layout={layout} groupActions={GlobalGroupActions} />;3. Tab Context Menus (tabContextMenu)
Global tabContextMenu and per-view viewSchema.tabContextMenu share the same RedDokiaTabContextMenuOption type.
- Shorthand (
append): Pass an item array or resolver callback to append below the built-in menu. - Config object (
{ mode: 'replace', items }): Replaces the built-in menu; optionally cherry-pick items fromdefaultItems. - Precedence:
viewSchema.tabContextMenuoverrides the global setting (inherited bytemplateIdclones).
ts
// 1) Per-view menu on viewSchema (takes precedence over global)
const views = [
{
id: 'per-view-menu-tab',
title: 'Per-View Menu',
tabContextMenu: {
mode: 'replace',
items: ({ defaultItems, viewId, controller }) => [
{
id: 'mark-verified',
label: 'Mark Verified',
icon: RedDokiaIcons.CheckCircle2,
action: () => controller.updateView(viewId, { badge: 'OK' }),
},
// Optionally reuse selected built-in items from defaultItems
...defaultItems.filter((item) => item.id === 'close-tab'),
],
},
},
];
// 2) Global fallback for views without viewSchema.tabContextMenu
<RedDokia
views={views}
layout={layout}
tabContextMenu={({ viewId, controller }) => [
{
id: 'mark-verified',
label: 'Mark Verified',
icon: RedDokiaIcons.CheckCircle2,
dividerBefore: true,
action: () => controller.updateView(viewId, { badge: 'OK' }),
},
]}
/>4. Next: Theming & i18n
For custom themes, themeTokens, and localization, see Theming, Design Tokens & i18n.