Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/docs/src/data/new-in.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@
"VTabs": {
"props": {
"spaced": "3.10.0"
},
"slots": {
"next": "3.10.0",
"prev": "3.10.0"
}
},
"VTextField": {
Expand Down
33 changes: 19 additions & 14 deletions packages/vuetify/src/components/VTabs/VTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { VTabsSymbol } from './shared'
import { convertToUnit, genericComponent, isObject, pick, propsFactory, useRender } from '@/util'

// Types
import type { VSlideGroupSlots } from 'lib/components/VSlideGroup/VSlideGroup'
import type { PropType } from 'vue'
import type { GenericProps } from '@/util'

Expand All @@ -30,7 +31,7 @@ export type VTabsSlot<T> = {
item: T
}

export type VTabsSlots<T> = {
export type VTabsSlots<T> = Pick<VSlideGroupSlots, 'next' | 'prev'> & {
default: never
tab: VTabsSlot<T>
item: VTabsSlot<T>
Expand Down Expand Up @@ -144,19 +145,23 @@ export const VTabs = genericComponent<new <T = TabItem>(
{ ...scopeId }
{ ...attrs }
>
{ slots.default?.() ?? items.value.map(item => (
slots.tab?.({ item }) ?? (
<VTab
{ ...item }
key={ item.text }
value={ item.value }
spaced={ props.spaced }
v-slots={{
default: slots[`tab.${item.value}`] ? () => slots[`tab.${item.value}`]?.({ item }) : undefined,
}}
/>
)
))}
{{
default: slots.default ?? (() => items.value.map(item => (
slots.tab?.({ item }) ?? (
<VTab
{ ...item }
key={ item.text }
value={ item.value }
spaced={ props.spaced }
v-slots={{
default: slots[`tab.${item.value}`] ? () => slots[`tab.${item.value}`]?.({ item }) : undefined,
}}
/>
)
))),
prev: slots.prev,
next: slots.next,
}}
</VSlideGroup>

{ hasWindow && (
Expand Down