{"library":"split.js","title":"Split.js","type":"library","description":"Split.js is a lightweight, 2kb gzipped utility for creating resizeable split views in web applications. It is currently stable at version 1.6.5 and maintains a consistent release cadence with minor bug fixes and feature enhancements, as seen in recent 1.5.x releases. Key differentiators include its zero-dependency footprint, small size, and high performance due to its pure CSS resizing approach without attaching window event listeners. It is unopinionated, working well with various layout models like `float` and `flex`, and boasts broad browser compatibility, supporting IE9 and early versions of modern browsers. It provides a simple API to create and manage split panels, allowing developers to control initial sizes, minimum/maximum sizes, gutter behavior, and drag intervals.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install split.js"],"cli":null},"imports":["import Split from 'split.js'","import type { SplitInstance, Options } from 'split.js'","<script src=\"https://unpkg.com/split.js/dist/split.min.js\"></script>"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://split.js.org/","github":"https://github.com/nathancahill/split","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/split.js","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"<!-- index.html -->\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <title>Split.js Quickstart</title>\n  <style>\n    #split-container {\n      display: flex; /* Use flexbox for horizontal split */\n      height: 300px;\n      border: 1px solid #ccc;\n      overflow: hidden;\n    }\n    .split-panel {\n      background-color: #f0f0f0;\n      padding: 15px;\n      overflow: auto;\n      flex-grow: 1; /* Allows panels to grow/shrink with split.js */\n    }\n    .gutter {\n      background-color: #eee;\n      background-repeat: no-repeat;\n      background-position: 50%;\n      cursor: col-resize; /* Default for horizontal splits */\n    }\n    .gutter.gutter-horizontal {\n      background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAxCAYAAAB2M2UfAAAAABmJLR0QA/wD/AP+Ad/gAAAAwSURBVDjLYwCCDQgGAgEC/j+P/n/8A4gBCAB+0M2KBAmDAAGg9QYAAAEhB0oBAAEGAAAAAElFTkSuQmCC');\n    }\n  </style>\n</head>\n<body>\n  <div id=\"split-container\">\n    <div id=\"panel-a\" class=\"split-panel\">Panel A</div>\n    <div id=\"panel-b\" class=\"split-panel\">Panel B</div>\n    <div id=\"panel-c\" class=\"split-panel\">Panel C</div>\n  </div>\n\n  <script type=\"module\">\n    import Split from 'split.js';\n\n    document.addEventListener('DOMContentLoaded', () => {\n      const split = Split(['#panel-a', '#panel-b', '#panel-c'], {\n        sizes: [33, 33, 34], // Initial sizes in percentage\n        minSize: 100,      // Minimum size for each panel in pixels\n        gutterSize: 8,     // Size of the gutter in pixels\n        cursor: 'col-resize', // Cursor to show when dragging (for horizontal)\n        onDrag: (sizes) => {\n          // console.log('Current sizes:', sizes);\n        },\n        onDragEnd: (sizes) => {\n          // console.log('Final sizes:', sizes);\n        }\n      });\n\n      // To dynamically change sizes (e.g., after an event)\n      // setTimeout(() => {\n      //   split.setSizes([20, 50, 30]);\n      // }, 3000);\n\n      // To destroy the split instance\n      // setTimeout(() => {\n      //   split.destroy();\n      // }, 6000);\n    });\n  </script>\n</body>\n</html>","lang":"typescript","description":"This quickstart demonstrates how to create a basic horizontal split view with three resizeable panels using Split.js, including initial sizing, minimum panel sizes, custom gutter styling, and event handlers for drag actions. It showcases typical setup for a modern web application using ES Modules.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}