flex-splitter-directive
flex-splitter-directive copied to clipboard
Dead simple panes splitter control based on flexbox. JS + CSS < 1kB (gzipped) with no dependencies.
trafficstars
flex-splitter-directive
Dead simple panes splitter control based on flexbox.
- Declarative.
Just add an attribute to the DOM element. Don't need to write any JavaScript. - Lightweight.
JS + CSS ~ 1.2kB (gzipped) with no dependencies.
Installation
npm (with a module bundler)
$ npm i flex-splitter-directive
import "flex-splitter-directive"
import "flex-splitter-directive/styles.min.css"
CDN (jsDelivr)
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/styles.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
Download Directly
Usage
- Load CSS and JS.
- Set
data-flex-splitter-horizontal(ordata-flex-splitter-verticalfor vertical) attribute to the parent element of the panes.- Optionally, specify the
keyboard-movementoption, as indata-flex-splitter-horizontal="keyboard-movement:10".
- Optionally, specify the
- Insert
<div role="separator" tabindex="1"></div>between each pane. - Set the following styles for each pane as required:
width/heightfor the initial size.min-width/min-heightfor the minimum size.max-width/max-heightfor the maximum size.flex: autofor filling space.