Socket
Book a DemoInstallSign in
Socket

split-views

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

split-views

Fast and Lightweight Utility for Resizable Split Views

2.1.4
latest
Source
npmnpm
Version published
Maintainers
1
Created
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

resizer

FAQs

Package last updated on 16 Apr 2022

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.