--- name: flexlayout-react description: FlexLayout for React - Advanced docking layout manager with drag-and-drop, tabs, splitters, and complex window management user-invocable: false disable-model-invocation: true version: 1.0.0 category: development author: Claude MPM Team license: MIT progressive_disclosure: entry_point: summary: "Professional docking layout system: drag-and-drop panels, tabs, splitters, persistence, complex multi-pane interfaces" when_to_use: "Building IDE-like interfaces, dashboard builders, multi-document editors, complex admin panels with draggable panes" quick_start: "1. Create model with Model.fromJson() 2. Wrap app in Layout component 3. Define factory function 4. Persist with model.toJson()" context_limit: 700 tags: - react - layout - docking - drag-drop - ide - dashboard - flexlayout requires_tools: [] --- # FlexLayout-React - Professional Docking Layouts ## Overview FlexLayout-React provides IDE-quality docking layouts with drag-and-drop, tabs, splitters, and complex window management. Perfect for dashboards, IDEs, admin panels, and any interface requiring flexible, user-customizable layouts. **Key Features**: - Drag-and-drop panel repositioning - Tabbed interfaces with close, maximize, minimize - Splitters for resizable panes - Border docking areas - Layout persistence (save/restore) - Programmatic layout control - TypeScript support **Installation**: ```bash npm install flexlayout-react ``` ## Basic Setup ### 1. Define Layout Model ```typescript import { Model, IJsonModel } from 'flexlayout-react'; const initialLayout: IJsonModel = { global: { tabEnableClose: true, tabEnableRename: false, }, borders: [], layout: { type: 'row', weight: 100, children: [ { type: 'tabset', weight: 50, children: [ { type: 'tab', name: 'Explorer', component: 'explorer', } ] }, { type: 'tabset', weight: 50, children: [ { type: 'tab', name: 'Editor', component: 'editor', } ] } ] } }; // Create model const model = Model.fromJson(initialLayout); ``` ### 2. Create Layout Component ```typescript import React, { useRef } from 'react'; import { Layout, Model, TabNode, IJsonTabNode } from 'flexlayout-react'; import 'flexlayout-react/style/dark.css'; // or light.css interface ComponentRegistry { explorer: React.ComponentType; editor: React.ComponentType; terminal: React.ComponentType; } function App() { const modelRef = useRef(Model.fromJson(initialLayout)); const factory = (node: TabNode) => { const component = node.getComponent(); switch (component) { case 'explorer': return ; case 'editor': return ; case 'terminal': return ; default: return
Unknown component: {component}
; } }; return (
); } ``` ### 3. Component Implementation ```typescript function ExplorerPanel() { return (

File Explorer

  • src/
  • public/
  • package.json
); } function EditorPanel() { return (