flexlayout-react

安装量: 77
排名: #10185

安装

npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill flexlayout-react

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:

npm install flexlayout-react

Basic Setup 1. Define Layout Model 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);

  1. Create Layout Component 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 <ExplorerPanel />;
        case 'editor':
            return <EditorPanel />;
        case 'terminal':
            return <TerminalPanel />;
        default:
            return <div>Unknown component: {component}</div>;
    }
};

return (
    <div style={{ width: '100vw', height: '100vh' }}>
        <Layout
            model={modelRef.current}
            factory={factory}
        />
    </div>
);

}

  1. Component Implementation function ExplorerPanel() { return (

    File Explorer

    • src/
    • public/
    • package.json
    ); }

function EditorPanel() { return (