Pane content in Vue Splitter component
11 Jun 202419 minutes to read
This section explains how to provide plain text content or HTML markup or integrate other JavaScript UI components as content of splitter.
HTML Markup
Splitter is a layout based container component. You can render the pane contents from existing HTML markups. Converting HTML markup as splitter pane is easy way to add the panes content dynamically.
<template>
<div id="app" class="col-lg-12 control-section default-splitter">
<ejs-splitter id='splitter' ref='splitterObj' width='600px' height='200px'>
<e-panes>
<e-pane :content='content1' size='200px'></e-pane>
<e-pane :content='content2' size='200px'></e-pane>
<e-pane :content='content3' size='200px'></e-pane>
</e-panes>
</ejs-splitter>
</div>
</template>
<script setup>
import { SplitterComponent as EjsSplitter, PanesDirective as EPanes, PaneDirective as EPane } from '@syncfusion/ej2-vue-layouts';
import { createApp } from 'vue';
var contentVue1 = createApp().component("contentTemp1", {
template: `<div class="content"><h3 class="h3">PARIS </h3>Paris, the city of lights and love - this short guide is full of ideas for how to make the most of the romanticism...</div>`,
data() {
return {
data: {}
};
}
});
var contentVue2 = createApp().component("contentTemp2", {
template: `<div class="content"><h3 class="h3">CAMEMBERT </h3>The village in the Orne département of Normandy where the famous French cheese is originated from.</div>`,
data() {
return {
data: {}
};
}
});
var contentVue3 = createApp().component("contentTemp3", {
template: `<div class="content"><h3 class="h3">GRENOBLE </h3>The capital city of the French Alps and a major scientific center surrounded by many ski resorts, host of the Winter Olympics in 1968.</div>`,
data() {
return {
data: {}
};
}
});
const content1 = () => {
return { template: contentVue1 }
};
const content2 = () => {
return { template: contentVue2 }
};
const content3 = () => {
return { template: contentVue3 }
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-layouts/styles/material.css";
#app {
margin: 65px auto;
}
.content {
padding: 10px;
}
.e-splitter {
margin: 0 auto;
}
</style>
<template>
<div id="app" class="col-lg-12 control-section default-splitter">
<ejs-splitter id='splitter' ref='splitterObj' width='600px' height='200px'>
<e-panes>
<e-pane :content='content1' size='200px'></e-pane>
<e-pane :content='content2' size='200px'></e-pane>
<e-pane :content='content3' size='200px'></e-pane>
</e-panes>
</ejs-splitter>
</div>
</template>
<script>
import { SplitterComponent, PanesDirective, PaneDirective } from '@syncfusion/ej2-vue-layouts';
import { createApp } from 'vue';
var contentVue1 = createApp().component("contentTemp1", {
template: `<div class="content"><h3 class="h3">PARIS </h3>Paris, the city of lights and love - this short guide is full of ideas for how to make the most of the romanticism...</div>`,
data() {
return {
data: {}
};
}
});
var contentVue2 = createApp().component("contentTemp2", {
template: `<div class="content"><h3 class="h3">CAMEMBERT </h3>The village in the Orne département of Normandy where the famous French cheese is originated from.</div>`,
data() {
return {
data: {}
};
}
});
var contentVue3 = createApp().component("contentTemp3", {
template: `<div class="content"><h3 class="h3">GRENOBLE </h3>The capital city of the French Alps and a major scientific center surrounded by many ski resorts, host of the Winter Olympics in 1968.</div>`,
data() {
return {
data: {}
};
}
});
export default {
name: "App",
components: {
"ejs-splitter": SplitterComponent,
"e-panes": PanesDirective,
"e-pane": PaneDirective
},
data() {
return {
content1: function () {
return { template: contentVue1 }
},
content2: function () {
return { template: contentVue2 }
},
content3: function () {
return { template: contentVue3 }
}
}
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-layouts/styles/material.css";
#app {
margin: 65px auto;
}
.content {
padding: 10px;
}
.e-splitter {
margin: 0 auto;
}
</style>
JavaScript UI components
You can render any JavaScript UI components along with their native and control events within splitter as pane content.
You can refer Accordion within splitter and Listview within splitter examples.
Plain content
You can add the plain text as a pane contents using either inner HTML or content API
<template>
<div id="app" class="col-lg-12 control-section default-splitter">
<ejs-splitter id='splitter' ref='splitterObj' width='600px' height='200px'>
<e-panes>
<e-pane content='Left Pane' size='200px'></e-pane>
<e-pane content='Middle Pane' size='200px'></e-pane>
<e-pane content='Right Pane' size='200px'></e-pane>
</e-panes>
</ejs-splitter>
</div>
</template>
<script setup>
import { SplitterComponent as EjsSplitter, PanesDirective as EPanes, PaneDirective as EPane } from '@syncfusion/ej2-vue-layouts';
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-layouts/styles/material.css";
#app {
text-align: center;
margin: 65px auto;
}
.content {
justify-content: center;
text-align: center;
align-items: center;
padding: 9px;
}
.e-splitter {
margin: 0 auto;
}
.e-pane {
text-align: center;
align-items: center;
display: grid;
}
</style>
<template>
<div id="app" class="col-lg-12 control-section default-splitter">
<ejs-splitter id='splitter' ref='splitterObj' width='600px' height='200px'>
<e-panes>
<e-pane content='Left Pane' size='200px'></e-pane>
<e-pane content='Middle Pane' size='200px'></e-pane>
<e-pane content='Right Pane' size='200px'></e-pane>
</e-panes>
</ejs-splitter>
</div>
</template>
<script>
import { SplitterComponent, PanesDirective, PaneDirective } from '@syncfusion/ej2-vue-layouts';
export default {
name: "App",
components: {
"ejs-splitter": SplitterComponent,
"e-panes": PanesDirective,
"e-pane": PaneDirective
},
data() {
return {}
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-layouts/styles/material.css";
#app {
text-align: center;
margin: 65px auto;
}
.content {
justify-content: center;
text-align: center;
align-items: center;
padding: 9px;
}
.e-splitter {
margin: 0 auto;
}
.e-pane {
text-align: center;
align-items: center;
display: grid;
}
</style>
Pane content using selector
You can set HTML element as pane content using the query selectors such as ID or CSS class selectors.
The following code demonstrates how to fetch an element from the document and load it to pane using its ID.
<template>
<div id="app" class="col-lg-12 control-section default-splitter">
<ejs-splitter id='splitter' ref='splitterObj' width='600px' height='200px'>
<e-panes>
<e-pane content='#left-pane-content' min='60px' size='200px'></e-pane>
<e-pane content='#middle-pane-content' min='60px' size='200px'></e-pane>
<e-pane content='#last-pane-content' min='60px' size='200px'></e-pane>
</e-panes>
</ejs-splitter>
<!-- pane contents -->
<div id="left-pane-content" style="display: none;">
<div>Left pane<div id='panetext'>size: 25%</div>
<div id='panetext'>min: 60px</div>
</div>
</div>
<div id="middle-pane-content" style="display: none;">
<span>Middle pane<div id="panetext">size: 50%</div>
<div id="panetext">min: 60px</div>
</span>
</div>
<div id="last-pane-content" style="display: none;">
<span>Right pane<div id="panetext">size: 25%</div>
<div id="panetext">min: 60px</div>
</span>
</div>
</div>
</template>
<script setup>
import { SplitterComponent as EjsSplitter, PanesDirective as EPanes, PaneDirective as EPane } from '@syncfusion/ej2-vue-layouts';
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-layouts/styles/material.css";
#app {
text-align: center;
margin: 65px auto;
}
.content {
justify-content: center;
text-align: center;
align-items: center;
padding: 9px;
}
.e-splitter {
margin: 0 auto;
}
.e-pane {
text-align: center;
align-items: center;
display: grid;
}
</style>
<template>
<div id="app" class="col-lg-12 control-section default-splitter">
<ejs-splitter id='splitter' ref='splitterObj' width='600px' height='200px'>
<e-panes>
<e-pane content='#left-pane-content' min='60px' size='200px'></e-pane>
<e-pane content='#middle-pane-content' min='60px' size='200px'></e-pane>
<e-pane content='#last-pane-content' min='60px' size='200px'></e-pane>
</e-panes>
</ejs-splitter>
<!-- pane contents -->
<div id="left-pane-content" style="display: none;">
<div>Left pane<div id='panetext'>size: 25%</div>
<div id='panetext'>min: 60px</div>
</div>
</div>
<div id="middle-pane-content" style="display: none;">
<span>Middle pane<div id="panetext">size: 50%</div>
<div id="panetext">min: 60px</div>
</span>
</div>
<div id="last-pane-content" style="display: none;">
<span>Right pane<div id="panetext">size: 25%</div>
<div id="panetext">min: 60px</div>
</span>
</div>
</div>
</template>
<script>
import { SplitterComponent, PanesDirective, PaneDirective } from '@syncfusion/ej2-vue-layouts';
export default {
name: "App",
components: {
"ejs-splitter": SplitterComponent,
"e-panes": PanesDirective,
"e-pane": PaneDirective
},
data() {
return {}
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-layouts/styles/material.css";
#app {
text-align: center;
margin: 65px auto;
}
.content {
justify-content: center;
text-align: center;
align-items: center;
padding: 9px;
}
.e-splitter {
margin: 0 auto;
}
.e-pane {
text-align: center;
align-items: center;
display: grid;
}
</style>