2019-03-29 10:42:15 +00:00
|
|
|
<template>
|
|
|
|
<div class="content-section documentation">
|
|
|
|
<TabView>
|
|
|
|
<TabPanel header="Documentation">
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Import</h5>
|
2019-03-29 10:42:15 +00:00
|
|
|
<CodeHighlight lang="javascript">
|
2019-05-25 15:47:08 +00:00
|
|
|
import TabView from 'primevue/tabview';
|
|
|
|
import TabPanel from 'primevue/tabpanel';
|
2019-03-29 10:42:15 +00:00
|
|
|
</CodeHighlight>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Getting Started</h5>
|
2019-03-29 10:42:15 +00:00
|
|
|
<p>Tabview element consists of one or more TabPanel elements. Header of the tab is defined using header attribute.</p>
|
|
|
|
<CodeHighlight>
|
|
|
|
<TabView>
|
2019-05-22 16:30:18 +00:00
|
|
|
<TabPanel header="Header I">
|
2019-03-29 10:42:15 +00:00
|
|
|
Content I
|
|
|
|
</TabPanel>
|
2019-05-22 16:30:18 +00:00
|
|
|
<TabPanel header="Header II">
|
2019-03-29 10:42:15 +00:00
|
|
|
Content II
|
|
|
|
</TabPanel>
|
2019-05-22 16:30:18 +00:00
|
|
|
<TabPanel header="Header III">
|
2019-03-29 10:42:15 +00:00
|
|
|
Content III
|
|
|
|
</TabPanel>
|
|
|
|
</TabView>
|
|
|
|
</CodeHighlight>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Active</h5>
|
2019-05-23 13:52:22 +00:00
|
|
|
<p>Visibility of the content is specified with the active property that supports one or two-way binding.</p>
|
2019-03-29 10:42:15 +00:00
|
|
|
<CodeHighlight>
|
|
|
|
<TabView>
|
2019-05-23 13:52:22 +00:00
|
|
|
<TabPanel header="Header I">
|
2019-03-29 10:42:15 +00:00
|
|
|
Content I
|
|
|
|
</TabPanel>
|
2019-05-23 13:52:22 +00:00
|
|
|
<TabPanel header="Header II" :active="true">
|
2019-03-29 10:42:15 +00:00
|
|
|
Content II
|
|
|
|
</TabPanel>
|
2019-05-23 13:52:22 +00:00
|
|
|
<TabPanel header="Header III">
|
2019-03-29 10:42:15 +00:00
|
|
|
Content III
|
|
|
|
</TabPanel>
|
|
|
|
</TabView>
|
|
|
|
</CodeHighlight>
|
|
|
|
|
2019-05-23 13:52:22 +00:00
|
|
|
<p>Two-way binding requires the sync operator.</p>
|
|
|
|
<CodeHighlight>
|
|
|
|
<TabView>
|
|
|
|
<TabPanel header="Header I" :active.sync="active1">
|
|
|
|
Content I
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header II" :active.sync="active2">
|
|
|
|
Content II
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header III" :active.sync="active3">
|
|
|
|
Content III
|
|
|
|
</TabPanel>
|
|
|
|
</TabView>
|
2019-03-29 10:42:15 +00:00
|
|
|
</CodeHighlight>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Disabled</h5>
|
2019-03-29 10:42:15 +00:00
|
|
|
<p>A tab can be disabled to prevent the content to be displayed by setting the disabled property on a panel.</p>
|
|
|
|
<CodeHighlight>
|
|
|
|
<TabView>
|
2019-05-22 16:30:18 +00:00
|
|
|
<TabPanel header="Header I">
|
2019-03-29 10:42:15 +00:00
|
|
|
Content I
|
|
|
|
</TabPanel>
|
2019-05-22 16:30:18 +00:00
|
|
|
<TabPanel header="Header II">
|
2019-03-29 10:42:15 +00:00
|
|
|
Content II
|
|
|
|
</TabPanel>
|
2019-05-22 16:30:18 +00:00
|
|
|
<TabPanel header="Header III" :disabled="true">
|
2019-03-29 10:42:15 +00:00
|
|
|
Content III
|
|
|
|
</TabPanel>
|
|
|
|
</TabView>
|
|
|
|
</CodeHighlight>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Header Template</h5>
|
2019-05-23 09:01:41 +00:00
|
|
|
<p>Custom content for the title section of a panel is defined using the header template.</p>
|
2019-03-29 10:42:15 +00:00
|
|
|
<CodeHighlight>
|
2019-05-22 16:30:18 +00:00
|
|
|
<TabView class="tabview-custom">
|
2019-03-29 10:42:15 +00:00
|
|
|
<TabPanel>
|
2019-05-22 16:30:18 +00:00
|
|
|
<template slot="header">
|
|
|
|
<i class="pi pi-calendar"></i>
|
2019-03-29 10:42:15 +00:00
|
|
|
<span>Header I</span>
|
|
|
|
</template>
|
|
|
|
Content I
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel>
|
2019-05-22 16:30:18 +00:00
|
|
|
<template slot="header">
|
2019-03-29 10:42:15 +00:00
|
|
|
<span>Header II</span>
|
2019-05-22 16:30:18 +00:00
|
|
|
<i class="pi pi-user"></i>
|
2019-03-29 10:42:15 +00:00
|
|
|
</template>
|
|
|
|
Content II
|
|
|
|
</TabPanel>
|
|
|
|
</TabView>
|
2019-05-23 13:52:22 +00:00
|
|
|
</CodeHighlight>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Programmatic Control</h5>
|
2019-05-23 13:52:22 +00:00
|
|
|
<p>Tabs can be controlled programmatically using active property that defines the active tab.</p>
|
|
|
|
<CodeHighlight>
|
|
|
|
<Button @click="activate(0)" class="p-button-secondary" label="Activate 1st" />
|
|
|
|
<Button @click="activate(1)" class="p-button-secondary" label="Activate 2st" />
|
|
|
|
<Button @click="activate(2)" class="p-button-secondary" label="Activate 3st" />
|
|
|
|
|
|
|
|
<TabView>
|
|
|
|
<TabPanel header="Header I" :active.sync="active[0]">
|
|
|
|
Content I
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header II" :active.sync="active[1]">
|
|
|
|
Content II
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header III" :active.sync="active[2]">
|
|
|
|
Content III
|
|
|
|
</TabPanel>
|
|
|
|
</TabView>
|
|
|
|
|
|
|
|
</CodeHighlight>
|
|
|
|
|
|
|
|
<CodeHighlight lang="js">
|
|
|
|
export default {
|
2019-05-23 14:20:14 +00:00
|
|
|
data() {
|
2019-05-23 13:52:22 +00:00
|
|
|
return {
|
|
|
|
active: [true, false, false]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
activate(index) {
|
|
|
|
let activeArray = [...this.active];
|
|
|
|
for (let i = 0 ; i < activeArray.length; i++) {
|
|
|
|
activeArray[i] = (i === index);
|
|
|
|
}
|
|
|
|
this.active = activeArray;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
2019-03-29 10:42:15 +00:00
|
|
|
</CodeHighlight>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Properties of TabPanel</h5>
|
2019-03-29 10:42:15 +00:00
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Type</th>
|
|
|
|
<th>Default</th>
|
|
|
|
<th>Description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>header</td>
|
|
|
|
<td>string</td>
|
|
|
|
<td>null</td>
|
|
|
|
<td>Orientation of tab headers.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>active</td>
|
|
|
|
<td>boolean</td>
|
|
|
|
<td>null</td>
|
|
|
|
<td>Visibility of the content.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>disabled</td>
|
|
|
|
<td>boolean</td>
|
|
|
|
<td>null</td>
|
|
|
|
<td>Whether the tab is disabled.</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Properties of TabView</h5>
|
2020-01-13 09:04:50 +00:00
|
|
|
<p>Any property as style and class are passed to the main container element.</p>
|
2019-10-01 13:00:26 +00:00
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Events</h5>
|
2019-03-29 10:42:15 +00:00
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
2019-05-23 09:01:41 +00:00
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Parameters</th>
|
|
|
|
<th>Description</th>
|
|
|
|
</tr>
|
2019-03-29 10:42:15 +00:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2019-05-23 09:01:41 +00:00
|
|
|
<tr>
|
|
|
|
<td>tab-change</td>
|
|
|
|
<td>event.originalEvent: Browser event <br/>
|
|
|
|
event.tab: Selected tab
|
|
|
|
</td>
|
|
|
|
<td>Callback to invoke when an active tab is changed.</td>
|
|
|
|
</tr>
|
2019-03-29 10:42:15 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Styling</h5>
|
2019-03-29 10:42:15 +00:00
|
|
|
<p>Following is the list of structural style classes, for theming classes visit <router-link to="/theming">theming</router-link> page.</p>
|
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
2019-05-23 09:01:41 +00:00
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Element</th>
|
|
|
|
</tr>
|
2019-03-29 10:42:15 +00:00
|
|
|
</thead>
|
|
|
|
<tbody>
|
2019-05-23 09:01:41 +00:00
|
|
|
<tr>
|
|
|
|
<td>p-tabview</td>
|
|
|
|
<td>Container element.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>p-tabview-nav</td>
|
|
|
|
<td>Container of headers.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>p-tabview-selected</td>
|
|
|
|
<td>Selected tab header.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>p-tabview-panels</td>
|
|
|
|
<td>Container panels.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>p-tabview-panel</td>
|
|
|
|
<td>Content of a tab.</td>
|
|
|
|
</tr>
|
2019-03-29 10:42:15 +00:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
2020-06-17 19:29:33 +00:00
|
|
|
<h5>Dependencies</h5>
|
2019-03-29 10:42:15 +00:00
|
|
|
<p>None.</p>
|
|
|
|
</TabPanel>
|
|
|
|
|
|
|
|
<TabPanel header="Source">
|
|
|
|
<a href="https://github.com/primefaces/primevue/tree/master/src/views/tabview" class="btn-viewsource" target="_blank" rel="noopener noreferrer">
|
|
|
|
<span>View on GitHub</span>
|
|
|
|
</a>
|
|
|
|
<CodeHighlight>
|
|
|
|
<template v-pre>
|
2020-06-18 09:24:46 +00:00
|
|
|
<div class="card">
|
|
|
|
<h5>Default</h5>
|
|
|
|
<TabView>
|
|
|
|
<TabPanel header="Header I">
|
|
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
|
|
|
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
|
|
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header II">
|
|
|
|
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
|
|
|
|
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
|
|
|
|
voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non numquam eius modi.</p>
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header III">
|
|
|
|
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati
|
|
|
|
cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio.
|
|
|
|
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus.</p>
|
|
|
|
</TabPanel>
|
|
|
|
</TabView>
|
2019-08-04 12:19:34 +00:00
|
|
|
</div>
|
2019-03-29 10:42:15 +00:00
|
|
|
|
2020-06-18 09:24:46 +00:00
|
|
|
<div class="card">
|
|
|
|
<h5>Programmatic</h5>
|
|
|
|
<div style="padding: .5rem 0 1rem 0">
|
|
|
|
<Button @click="activate(0)" class="p-button-secondary" label="Activate 1st" />
|
|
|
|
<Button @click="activate(1)" class="p-button-secondary" label="Activate 2nd" />
|
|
|
|
<Button @click="activate(2)" class="p-button-secondary" label="Activate 3rd" />
|
|
|
|
</div>
|
2019-03-29 10:42:15 +00:00
|
|
|
|
2020-06-18 09:24:46 +00:00
|
|
|
<TabView>
|
|
|
|
<TabPanel header="Header I" :active.sync="active[0]">
|
|
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
|
|
|
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
|
|
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header II" :active.sync="active[1]">
|
|
|
|
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
|
|
|
|
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
|
|
|
|
voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non numquam eius modi.</p>
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header III" :active.sync="active[2]">
|
|
|
|
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati
|
|
|
|
cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio.
|
|
|
|
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus.</p>
|
|
|
|
</TabPanel>
|
|
|
|
</TabView>
|
|
|
|
</div>
|
2019-03-29 10:42:15 +00:00
|
|
|
|
2020-06-18 09:24:46 +00:00
|
|
|
<div class="card">
|
|
|
|
<h5>Disabled</h5>
|
|
|
|
<TabView>
|
|
|
|
<TabPanel header="Header I">
|
|
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
|
|
|
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
|
|
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header II">
|
|
|
|
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
|
|
|
|
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
|
|
|
|
voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non numquam eius modi.</p>
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header III">
|
|
|
|
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati
|
|
|
|
cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio.
|
|
|
|
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus.</p>
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel header="Header IV" :disabled="true"></TabPanel>
|
|
|
|
</TabView>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="card">
|
|
|
|
<h5>Custom Headers</h5>
|
|
|
|
<TabView class="tabview-custom">
|
|
|
|
<TabPanel>
|
|
|
|
<template slot="header">
|
|
|
|
<i class="pi pi-calendar"></i>
|
|
|
|
<span>Header I</span>
|
|
|
|
</template>
|
|
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
|
|
|
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
|
|
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel>
|
|
|
|
<template slot="header">
|
|
|
|
<span>Header II</span>
|
|
|
|
<i class="pi pi-user"></i>
|
|
|
|
</template>
|
|
|
|
<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
|
|
|
|
architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
|
|
|
|
voluptatem sequi nesciunt. Consectetur, adipisci velit, sed quia non numquam eius modi.</p>
|
|
|
|
</TabPanel>
|
|
|
|
<TabPanel>
|
|
|
|
<template slot="header">
|
|
|
|
<i class="pi pi-search"></i>
|
|
|
|
<span>Header III</span>
|
|
|
|
<i class="pi pi-cog"></i>
|
|
|
|
</template>
|
|
|
|
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati
|
|
|
|
cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio.
|
|
|
|
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus.</p>
|
|
|
|
</TabPanel>
|
|
|
|
</TabView>
|
|
|
|
</div>
|
2019-03-29 10:42:15 +00:00
|
|
|
</template>
|
|
|
|
</CodeHighlight>
|
|
|
|
|
|
|
|
<CodeHighlight lang="javascript">
|
|
|
|
export default {
|
2019-05-23 14:20:14 +00:00
|
|
|
data() {
|
2019-05-23 13:52:22 +00:00
|
|
|
return {
|
|
|
|
active: [true, false, false]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
activate(index) {
|
|
|
|
let activeArray = [...this.active];
|
|
|
|
for (let i = 0 ; i < activeArray.length; i++) {
|
|
|
|
activeArray[i] = (i === index);
|
|
|
|
}
|
|
|
|
this.active = activeArray;
|
|
|
|
}
|
|
|
|
}
|
2019-03-29 10:42:15 +00:00
|
|
|
</CodeHighlight>
|
|
|
|
|
|
|
|
<CodeHighlight lang="css">
|
|
|
|
.tabview-custom {
|
|
|
|
i, span {
|
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
|
|
|
|
span {
|
2020-05-14 08:51:13 +00:00
|
|
|
margin: 0 .5rem;
|
2019-03-29 10:42:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</CodeHighlight>
|
|
|
|
</TabPanel>
|
|
|
|
</TabView>
|
|
|
|
</div>
|
|
|
|
</template>
|