Skip to content

Commit

Permalink
feat(Tabs): add content prop to avoid the render of the HTML markup (
Browse files Browse the repository at this point in the history
…#1831)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
  • Loading branch information
emavitta and benjamincanac committed Jun 4, 2024
1 parent 831c560 commit 6e2678d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/content/2.components/tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ componentProps:
---
::

You can use the `content` prop and set it to `false` to avoid the rendering of the HTML content if you don't need it.

### Control the selected index

Use a `v-model` to control the selected index.
Expand Down
6 changes: 5 additions & 1 deletion src/runtime/components/navigation/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</HTab>
</HTabList>

<HTabPanels :class="ui.container">
<HTabPanels v-if="content" :class="ui.container">
<HTabPanel v-for="(item, index) of items" :key="index" v-slot="{ selected }" :class="ui.base" :unmount="unmount">
<slot :name="item.slot || 'item'" :item="item" :index="index" :selected="selected">
{{ item.content }}
Expand Down Expand Up @@ -88,6 +88,10 @@ export default defineComponent({
type: Boolean,
default: false
},
content: {
type: Boolean,
default: true
},
class: {
type: [String, Object, Array] as PropType<any>,
default: () => ''
Expand Down

0 comments on commit 6e2678d

Please sign in to comment.