Skip to content

Commit

Permalink
docs: add active prop to header slot
Browse files Browse the repository at this point in the history
  • Loading branch information
mlmoravek committed Dec 2, 2024
1 parent c2b4f51 commit 578cdea
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/docs/components/Tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ sidebarDepth: 2
| Name | Description | Bindings |
| ------- | --------------------- | --------------------------------------- |
| default | Tab item content | **active** `boolean` - if item is shown |
| header | Override header label | |
| header | Override header label | **active** `boolean` - if item is shown |

</div>

Expand Down
3 changes: 2 additions & 1 deletion packages/oruga/src/components/tabs/TabItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ const panelClasses = defineClasses(["tabPanelClass", "o-tabs__panel"]);
<template v-if="false">
<!--
@slot Override header label
@binding {boolean} active - if item is shown
-->
<slot name="header" />
<slot name="header" :active="isActive && visible" />
</template>
</div>
</Transition>
Expand Down
3 changes: 3 additions & 0 deletions packages/oruga/src/components/tabs/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ const contentClasses = defineClasses(
:tag="childItem.tag"
name="header"
:class="childItem.classes"
:props="{
active: childItem.index === activeIndex,
}"
@click="tabClick(childItem)"
@keydown.enter="tabClick(childItem)"
@keydown.left="prev($event, childItem.index)"
Expand Down

0 comments on commit 578cdea

Please sign in to comment.