Splitter

Splitter is utilized to separate and resize panels.


npx volt-vue add Splitter


import Splitter from '@/volt/Splitter.vue';
import SplitterPanel from 'primevue/splitterpanel';

Splitter requires two SplitterPanel components as children which are displayed horizontally by default.

Panel 1
Panel 2

<template>
    <div class="card">
        <Splitter style="height: 300px" class="mb-8">
            <SplitterPanel class="flex items-center justify-center"> Panel 1 </SplitterPanel>
            <SplitterPanel class="flex items-center justify-center"> Panel 2 </SplitterPanel>
        </Splitter>
    </div>
</template>

<script setup lang="ts">
import Splitter from '@/volt/Splitter.vue';
import SplitterPanel from 'primevue/splitterpanel';
</script>

Initial dimension of a panel is percentage based and defined using the size property. In addition,minSize is provided to set a minimum value during a resize.

Panel 1
Panel 2

<template>
    <div class="card">
        <Splitter style="height: 300px">
            <SplitterPanel class="flex items-center justify-center" :size="25" :minSize="10"> Panel 1 </SplitterPanel>
            <SplitterPanel class="flex items-center justify-center" :size="75"> Panel 2 </SplitterPanel>
        </Splitter>
    </div>
</template>

<script setup lang="ts">
import Splitter from '@/volt/Splitter.vue';
import SplitterPanel from 'primevue/splitterpanel';
</script>

Splitters can be combined to create advanced layouts.

Panel 1
Panel 2
Panel 3
Panel 4

<template>
    <div class="card">
        <Splitter style="height: 300px">
            <SplitterPanel class="flex items-center justify-center" :size="20" :minSize="10"> Panel 1 </SplitterPanel>
            <SplitterPanel :size="80">
                <Splitter layout="vertical">
                    <SplitterPanel class="flex items-center justify-center" :size="15"> Panel 2 </SplitterPanel>
                    <SplitterPanel :size="85">
                        <Splitter>
                            <SplitterPanel class="flex items-center justify-center" :size="20"> Panel 3 </SplitterPanel>
                            <SplitterPanel class="flex items-center justify-center" :size="80"> Panel 4 </SplitterPanel>
                        </Splitter>
                    </SplitterPanel>
                </Splitter>
            </SplitterPanel>
        </Splitter>
    </div>
</template>

<script setup lang="ts">
import Splitter from '@/volt/Splitter.vue';
import SplitterPanel from 'primevue/splitterpanel';
</script>

Splitters can be combined to create advanced layouts.

Panel 1
Panel 2
Panel 3
Panel 4

<template>
    <div class="card">
        <Splitter style="height: 300px">
            <SplitterPanel class="flex items-center justify-center" :size="20" :minSize="10"> Panel 1 </SplitterPanel>
            <SplitterPanel :size="80">
                <Splitter layout="vertical">
                    <SplitterPanel class="flex items-center justify-center" :size="15"> Panel 2 </SplitterPanel>
                    <SplitterPanel :size="85">
                        <Splitter>
                            <SplitterPanel class="flex items-center justify-center" :size="20"> Panel 3 </SplitterPanel>
                            <SplitterPanel class="flex items-center justify-center" :size="80"> Panel 4 </SplitterPanel>
                        </Splitter>
                    </SplitterPanel>
                </Splitter>
            </SplitterPanel>
        </Splitter>
    </div>
</template>

<script setup lang="ts">
import Splitter from '@/volt/Splitter.vue';
import SplitterPanel from 'primevue/splitterpanel';
</script>