Introduction
flex-splitter-directive is a flexbox-based panes splitter control.
- Declarative.
You don't need to write any JavaScript. Just add an attribute to the DOM element. - 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
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flex-splitter-directive@0.5.1/styles.min.css">
<script src="https://cdn.jsdelivr.net/npm/flex-splitter-directive@0.5.1"></script>
Usage
- Load CSS and JS.
- Set
data-flex-splitter-horizontal/data-flex-splitter-verticalattribute to the parent element of the panes. - 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.