Vue Tabs - Flowbite
Use these responsive tabs components to create a secondary navigational hierarchy for your website or toggle content inside a container
TIP
Original reference: https://flowbite.com/docs/components/tabs/
The tabs component can be used either as an extra navigational hierarchy complementing the main navbar or you can also use it to change content inside a container just below the tabs using the data attributes from Flowbite.
Prop - variant (default)
- First
- Second
- Third
- Fourth
Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto asperiores odio minima temporibus eligendi deleniti vitae illo quo, fuga nobis saepe error totam inventore ullam accusamus, deserunt unde est. Atque.
vue
<template>
<fwb-tabs v-model="activeTab" class="p-5">
<fwb-tab name="first" title="First">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="second" title="Second">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="third" title="Third">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="fourth" title="Fourth" disabled>
Lorem ipsum dolor...
</fwb-tab>
</fwb-tabs>
</template>
<script setup>
import { ref } from 'vue'
import { FwbTab, FwbTabs } from 'flowbite-vue'
const activeTab = ref('first')
</script>
Prop - variant (underline)
- First
- Second
- Third
- Fourth
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab aspernatur debitis iste libero molestiae mollitia, optio sunt? A, consectetur distinctio, eaque harum iusto laudantium, molestiae nam odio officia pariatur vitae?
vue
<template>
<fwb-tabs v-model="activeTab" variant="underline" class="p-5">
<fwb-tab name="first" title="First">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="second" title="Second">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="third" title="Third">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="fourth" title="Fourth" disabled>
Lorem ipsum dolor...
</fwb-tab>
</fwb-tabs>
</template>
<script setup>
import { ref } from 'vue'
import { FwbTab, FwbTabs } from 'flowbite-vue'
const activeTab = ref('first')
</script>
Prop - variant (pills)
- First
- Second
- Third
- Fourth
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab aspernatur debitis iste libero molestiae mollitia, optio sunt? A, consectetur distinctio, eaque harum iusto laudantium, molestiae nam odio officia pariatur vitae?
vue
<template>
<fwb-tabs v-model="activeTab" variant="pills" class="p-5">
<fwb-tab name="first" title="First" >
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="second" title="Second">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="third" title="Third">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="fourth" title="Fourth" disabled>
Lorem ipsum dolor...
</fwb-tab>
</fwb-tabs>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { FwbTab, FwbTabs } from 'flowbite-vue'
const activeTab = ref('first')
</script>
Prop - directive
Use this props if you want to control which directive to use for rendering every tab content
- First
- Second
- Third
- Fourth
Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto asperiores odio minima temporibus eligendi deleniti vitae illo quo, fuga nobis saepe error totam inventore ullam accusamus, deserunt unde est. Atque.
vue
<template>
<fwb-tabs v-model="activeTab" directive="show" class="p-5">
<fwb-tab name="first" title="First">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="second" title="Second">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="third" title="Third">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="fourth" title="Fourth" disabled>
Lorem ipsum dolor...
</fwb-tab>
</fwb-tabs>
</template>
<script setup>
import { ref } from 'vue'
import { FwbTab, FwbTabs } from 'flowbite-vue'
const activeTab = ref('first')
</script>
Tab pane interaction
You can add @click:pane
to Tabs component to intercept click on tab pane.
- First
- Second
- Third
- Fourth
Lorem ipsum dolor sit amet consectetur adipisicing elit. Iusto asperiores odio minima temporibus eligendi deleniti vitae illo quo, fuga nobis saepe error totam inventore ullam accusamus, deserunt unde est. Atque.
vue
<template>
<fwb-tabs @click:pane="handlePaneClick" v-model="activeTab" class="p-5">
<fwb-tab name="first" title="First">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="second" title="Second">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="third" title="Third">
Lorem ipsum dolor...
</fwb-tab>
<fwb-tab name="fourth" title="Fourth" disabled>
Lorem ipsum dolor...
</fwb-tab>
</fwb-tabs>
</template>
<script setup>
import { ref } from 'vue'
import { FwbTab, FwbTabs } from 'flowbite-vue'
const activeTab = ref('first')
const handlePaneClick = () => { console.log('Click!') }
</script>
API
Props
Name | Values | Default |
---|---|---|
directive | if , show | if |
modelValue | string | '' |
variant | default , underline , pill | default |