Install Splitpanes
main@legacy tag for Vue 2 projects.repository·main·Indexed 25 days ago
https://github.com/antoniandre/splitpanesA reliable, simple, and touch-ready panes splitter and resizer for Vue.js applications. Supports Vue 3 and Vue 2 (via legacy package), providing components for layout containers and individual panes with configurable size constraints, orientation, and event handling for resizing and maximization.
@legacy tag for Vue 2 projects.Splitpanes supports the latest versions of the following browsers:
splitpanes package exports two primary components: Splitpanes (the container) and Pane (the individual split sections). To build a split-pane interface, you must wrap Pane components inside a Splitpanes component.The Splitpanes component accepts the following configuration props to control the layout behavior:
horizontal (boolean, optional): Sets the orientation of the panes. Defaults to vertical if not specified.pushOtherPanes (boolean, optional): Determines if resizing a pane should push other panes.maximizePanes (boolean, optional): Enables pane maximization functionality.rtl (boolean, optional): Enables Right-to-Left layout.firstSplitter (boolean, optional): Controls whether the first splitter is rendered.keyboardStep (number, optional): Defines the step size for keyboard-based resizing.interface SplitpanesProps {
horizontal?: boolean
pushOtherPanes?: boolean
maximizePanes?: boolean
rtl?: boolean
firstSplitter?: boolean
keyboardStep?: number
}The Splitpanes component emits several events that allow you to react to layout changes and user interactions. The payloads for these events include information about the panes and the specific interaction:
| Event | Payload Interface | Description |
|---|---|---|
ready | SplitpanesReadyPayload | Fired when the component is initialized. Includes panes: PaneData[] |
resize | SplitpanesResizePayload | Fired during splitter drag. Includes event, index, prevPane, nextPane, and panes |
resized | SplitpanesResizedPayload | Fired after drag-end or pane add/remove. event, index, prevPane, and nextPane are optional |
pane-click | SplitpanesPaneClickPayload | Fired when a pane is clicked. Includes event, index, pane, and panes |
pane-maximize | SplitpanesPaneMaximizePayload | Fired when a pane is maximized. Includes event, index, pane, and panes |
pane-add | SplitpanesPaneAddPayload | Fired when a pane is added. Includes pane and panes |
pane-remove | SplitpanesPaneRemovePayload | Fired when a pane is removed. Includes pane and panes |
splitter-click | SplitpanesSplitterClickPayload | Fired on splitter click. Includes event, index, prevPane, nextPane, and panes |
splitter-dblclick | SplitpanesSplitterClickPayload | Fired on splitter double-click. Same payload as splitter-click |
direction-changed | SplitpanesDirectionChangedPayload | Fired when orientation changes. Includes horizontal and panes |
The Pane component (used inside Splitpanes) accepts the following props to define its individual constraints:
size (number | string, optional): The initial size of the pane.minSize (number | string, optional): The minimum allowable size for the pane.maxSize (number | string, optional): The maximum allowable size for the pane.interface PaneProps {
size?: number | string
minSize?: number | string
maxSize?: number | string
}When interacting with Splitpanes events, you will receive data structures representing the state of the panes.
Used to represent the size constraints and current size of a pane in a simplified format.
min: numbermax: numbersize: numberRepresents a specific pane instance within the component.
id: numberel: HTMLElement | nullmin: numbermax: numbergivenSize: number | nullsize: numberindex: numberexport interface PaneData {
min: number
max: number
size: number
}
export interface Pane {
id: number
el: HTMLElement | null
min: number
max: number
givenSize: number | null
size: number
index: number
}