split-dock
v1.0.2
Published
A lightweight, flexible docking framework for building split-view layouts with drag-and-drop panel management
Maintainers
Readme
split-dock
A lightweight docking framework for split-view layouts with drag-and-drop panel management.
Installation
npm install split-dockOr use via CDN:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/split-dock/src/style.css">
<script type="module" src="https://cdn.jsdelivr.net/npm/split-dock/src/index.js"></script>Usage
Create an HTML structure with the following classes:
<div id="app" class="sd-frame horizontal">
<div class="sd-dock">
<div class="sd-panel">
<div class="sd-panel-title">Panel 1</div>
<div class="sd-panel-content">
<p>Your content here</p>
</div>
</div>
</div>
</div>The framework auto-initializes on page load.
Classes
sd-frame: Container for docks or nested frames. Addhorizontalorverticalfor split direction.sd-dock: Panel container with tab navigation.sd-panel: Individual panel with title and content.sd-panel-title: Panel tab title.sd-panel-content: Panel content area.
Features
- Drag panels to dock edges to create splits
- Drag tabs to reorder within or between docks
- Resize panes with handles
- Empty docks auto-removed
Configuration
Modify constants in CONFIG object:
import { CONFIG } from 'split-dock';
CONFIG.layout.minPaneSize = 150; // Minimum pane size (px)
CONFIG.layout.dropZoneRatio = 0.25; // Drop zone edge ratio
CONFIG.layout.dragGhostOffset = 15; // Drag ghost offset (px)
CONFIG.layout.defaultFlexBasis = '1 1 0px';
CONFIG.ui.closeButtonSymbol = '×';
CONFIG.ui.defaultPanelTitle = 'New Panel';License
MIT
