Vue Split Pane
A Vue 3 component for creating resizable split panes. This component allows you to easily create layouts with resizable panels, either horizontally or vertically. It supports various features such as initial size, minimum and maximum size constraints, and nested panes.
See the example and associated code in ExampleLayout
[Demo | Changelog | View Example]
Quick Start
This package has two major exports:
<SplitPane>
: is used to create resizable panels within a layout. It supports both vertical and horizontal splits, allowing users to adjust the size of different sections of a page.
<Pane>
: is a part of the SplitPane layout system, representing an individual resizable panel. It supports both vertical and horizontal splits and allows for flexible sizing and styling.
To quickly start using @marsio/vue-split-pane
, follow the steps below:
Step 1: Installation
First, you need to install the package. Run the following command in your project directory:
npm install @marsio/vue-split-pane
or if you prefer using Yarn:
yarn add @marsio/vue-split-pane
or if you prefer using Pnpm:
pnpm add @marsio/vue-split-pane
Step 2: Importing
In your Vue component, import @marsio/vue-split-pane
:
import SplitPane, { Pane } from '@marsio/vue-split-pane';
Step 3: Using @marsio/vue-split-pane
Now, you can use the SplitPane
component in your Vue application
<template>
<SplitPane>
<Pane>This is a Pane</Pane>
<Pane>This is a Pane</Pane>
</SplitPane>
</template>
<script>
import SplitPane, { Pane } from '@marsio/vue-split-pane';
export default {
components: {
SplitPane,
Pane
}
}
</script>
Or Hybrid
<template>
<SplitPane split="vertical">
<Pane initialSize="200px">You can use a Pane component</Pane>
<div>or you can use a plain old div</div>
<Pane initialSize="25%" minSize="10%" maxSize="500px">Using a Pane allows you to specify any constraints directly</Pane>
</SplitPane>
</template>
<script>
import SplitPane, { Pane } from '@marsio/vue-split-pane';
export default {
components: {
SplitPane,
Pane
}
}
</script>
Or Nested
<template>
<SplitPane split="vertical">
<Pane/>
<Pane/>
<SplitPane split="horizontal">
<Pane/>
<Pane/>
<Pane/>
</SplitPane>
<Pane/>
</SplitPane>
</template>
<script>
import SplitPane, { Pane } from '@marsio/vue-split-pane';
export default {
components: {
SplitPane,
Pane
}
}
</script>
Step 4: Enjoy!
That's it! You've successfully integrated split pane functionality into your Vue application. Customize it further according to your needs.
<SplitPane>
Props:
allowResize: { type: Boolean, default: true },
resizerSize: {
type: Number,
default: 1
},
split: {
type: String as PropType<"vertical" | "horizontal">,
default: 'vertical'
},
step: { type: Number, default: 1 }
<Pane>
Props:
index: {
type: Number as PropType<number>
},
class: {
type: String as PropType<string>
},
split: {
type: String as PropType<'vertical' | 'horizontal'>
},
initialSize: {
type: [String, Number] as PropType<string | number>,
default: '1'
},
minSize: {
type: String as PropType<string>,
default: '0'
},
maxSize: {
type: String as PropType<string>,
default: '100%'
},
size: {
type: String as PropType<string>
},
innerRef: {
type: Function,
default: () => () => {}
},
resizersSize: {
type: Number,
default: 1
}
Modern browsers.
Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
Changelog.
Detailed changes for each release are documented in the release notes.
Release checklist
- Update CHANGELOG
pnpm release
pnpm publish
License
MIT
[1.0.0] - (August 18, 2024)
Documentation
Features
- Add configuration files and dependencies
- Add Resizer component for draggable resizing
- Add Pane component for resizable panes
- Add Pane and Resizer components for resizable and draggable panes
- Add CJS module exports for SplitPane and Pane
- Add HTML template for Vue3 Split Pane example page
- Add typings for Vue3 SplitPane and Pane components
Version History