Merge pull request #3290 from primefaces/issue-3217

Sidebar: Header slot added
pull/3732/head
Tuğçe Küçükoğlu 2022-11-18 10:51:34 +03:00 committed by GitHub
commit 96d28bc642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 2 deletions

View File

@ -60,11 +60,19 @@ const SidebarEvents = [
}
];
const SidebarSlots = [
{
name: "header",
description: "Custom content for the component's header"
}
];
module.exports = {
sidebar: {
name: "Sidebar",
description: "Sidebar is a panel component displayed as an overlay at the edges of the screen.",
props: SidebarProps,
events: SidebarEvents
events: SidebarEvents,
slots: SidebarSlots
}
};

View File

@ -13,6 +13,7 @@ declare class Sidebar extends Vue {
$emit(eventName: 'hide'): this;
$slots: {
'': VNode[];
'header': VNode[];
}
}

View File

@ -2,6 +2,9 @@
<transition name="p-sidebar" @enter="onEnter" @leave="onLeave" appear>
<div :class="containerClass" v-if="visible" ref="container" role="complementary" :aria-modal="modal">
<div class="p-sidebar-header">
<div v-if="$slots.header" class="p-sidebar-header-content">
<slot name="header"></slot>
</div>
<button class="p-sidebar-close p-sidebar-icon p-link" @click="hide" :aria-label="ariaCloseLabel" v-if="showCloseIcon" type="button" v-ripple>
<span class="p-sidebar-close-icon pi pi-times" />
</button>

View File

@ -131,6 +131,24 @@ import Sidebar from 'primevue/sidebar';
</table>
</div>
<h5>Slots</h5>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Name</th>
<th>Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td>header</td>
<td>-</td>
</tr>
</tbody>
</table>
</div>
<h5>Styling</h5>
<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">

View File

@ -223,4 +223,4 @@ export default {
</TabPanel>
</TabView>
</div>
</template>
</template>