fix(Tabs): horizontal orientation

This commit is contained in:
Benjamin Canac
2024-04-15 14:22:49 +02:00
parent 84847965af
commit 1e65933d9c
4 changed files with 70 additions and 50 deletions

View File

@@ -44,14 +44,17 @@ import { defu } from 'defu'
import { TabsRoot, TabsList, TabsIndicator, TabsTrigger, TabsContent, useForwardPropsEmits } from 'radix-vue'
import { reactivePick } from '@vueuse/core'
const props = withDefaults(defineProps<TabsProps<T>>(), { defaultValue: '0' })
const props = withDefaults(defineProps<TabsProps<T>>(), {
defaultValue: '0',
orientation: 'horizontal'
})
const emits = defineEmits<TabsEmits>()
defineSlots<TabsSlots<T>>()
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'defaultValue', 'orientation', 'activationMode', 'modelValue'), emits)
const contentProps = toRef(() => defu(props.content, { forceMount: true }) as TabsContentProps)
const ui = computed(() => tv({ extend: tabs, slots: props.ui })())
const ui = computed(() => tv({ extend: tabs, slots: props.ui })({ orientation: props.orientation }))
</script>
<template>