Skip to content
On this page

Props

Component props.

INFO

Detailed description of the parameters on the official documentation page Split.js

OptionsTypeDefaultDescription
sizesnumber[]Initial sizes of each element in percents or CSS values.
minSizenumber | number[]100Minimum size of each element.
maxSizenumber | number[]InfinityMaximum size of each element.
expandToMinbooleanfalseGrow initial sizes to minSize
gutterSizenumber10Gutter size in pixels.
gutterAlignstart | end | center'center'Gutter alignment between elements.
snapOffsetnumber30Snap to minimum size offset in pixels.
dragIntervalnumber1Number of pixels to drag.
directionhorizontal | vertical'horizontal'Direction to split: horizontal or vertical.

Emits

Component emits.

EmitsPayloadDescription
onDragsizes: number[]Callback on drag.
onDragStartsizes: number[]Callback on drag start.
onDragEndsizes: number[]Callback on drag end.
update:collapsenullCallback after collapse one of items.

API

You can use the collapse prop to manually collapse the element.
To achieve this you need to use v-model directive and set the index of the element you want to collapse.
It will be automatically collapse when the value of the prop changes and emit event to set the value to null.
See the example here

html
<script setup lang="ts">
import { SplitWrapper, SplitItem } from 'vue-split'

const collapse = ref<number | null>(null)

const collapseFirstElement = () => {
  collapse.value = 0
}
</script>

<template>
  <SplitWrapper v-model:collapse="collapse">
    <SplitItem>
      <div>First item</div>
    </SplitItem>
    <SplitItem>
      <div>Second item</div>
    </SplitItem>
  </SplitWrapper>
</template>
</script>