Socket
Socket
Sign inDemoInstall

split-views

Package Overview
Dependencies
0
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    split-views

Fast and Lightweight Utility for Resizable Split Views


Version published
Weekly downloads
6
decreased by-62.5%
Maintainers
1
Install size
16.8 kB
Created
Weekly downloads
 

Readme

Source

✂ SplitViews

Utility for resizable split views.

  • Fast & Simple to use.
  • Lightweight <1kb.
  • Zero dependencies.
  • No events listeners are attached to Window.
  • Compatible: Firefox - Chrome - Safari - Opera - Android - (FlexBox is not supported in IE).
split-views split-views split-views split-views split-views

Split views


Demo

$ npm i split-views
# or
$ yarn add split-views

Usage

import SplitViews from 'split-views';

Or include it via jsDelivr CDN (UMD):

<script src="https://cdn.jsdelivr.net/npm/split-views/build/index.min.js"></script>
<!-- Or via unpkg -->
<script src="https://unpkg.com/split-views"></script>
<!-- Access via global object : window.SplitViews -->

Documentation

  • SplitViews(options: Object): Object
OptionsTypeDefaultDescription
parentHTMLElement or String'.split-view'Parent element.
sizesArray<Number>[]Initial sizes of each element in %.
minSizeNumber0Minimum size.
gutterSizeNumber5Gutter size (seperator).
directionString'horizontal'Resize direction: horizontal or vertical.
onDragEndMethodnullCallback with new sizes in %.

Methods & Examples

const options = {
  parent: '#parent-id', // or HTMLElement
  direction: 'horizontal',
  gutterSize: 5,
  minSize: 20,
  sizes: [25, 50, 25],
  onDragEnd: (newSizes) => {
    console.log(newSizes);
  }
};

const sp = SplitViews(options)

// detroy method: remove "touchstart" and "mousedown" events
// the others events are removed by default
sp.detroy() 
  • React: React component wrapper

Notes

  • Tested on Chrome 67, Firefox 67, Edge 70, Opera 67, Safari 11, Android (>= 4).
  • SplitViews is flex-based.
  • All pull requests are welcome, feel free.

Author

License

MIT

Keywords

FAQs

Last updated on 16 Apr 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc