Material UI Touch-Swipe Tabs Component for Vue 3

Vue3 tabs is a mobile-friendly tabs plugin that allows users to swipe between tabbed content via a quick touch swipe.

simple tabs component codesandbox, material ui tabs example, best react tabs component, responsive tabs material ui, material ui dynamic tabs, vertical tabs in bootstrap

How to make use of it:

Install and download:

# Yarn
$ yarn add vue3-tabs

# NPM
$ npm i vue3-tabs --save

1. Import and register tabs component.

// globally
import { createApp } from 'vue';
import App from './App.vue'
import Tabs from 'vue3-tabs';
const app = createApp(App);
app.use(Tabs);
app.mount('#app');
// locally
import { Tabs, Tab, TabPanels, TabPanel } from 'vue3-tabs';
export default {
  components: {
    Tabs,
    Tab,
    TabPanels,
    TabPanel
  },
};

2. Create a basic tabs component.

<template>
  <h3>Basic Example</h3>
  <tabs
    v-model="selectedTab"
  >
    <tab
      v-for="(tab, i) in tabs"
      :key="`t${i}`"
      :val="tab"
      :label="tab"
      :indicator="true"
    />
  </tabs>
  <tab-panels
    v-model="selectedTab"
    :animate="true"
    :swipeable="true"
  >
    <tab-panel
      v-for="(tab, i) in tabs"
      :key="`tp${i}`"
      :val="tab"
    >
      {{ tab }}
    </tab-panel>
  </tab-panels>
</template>
import { defineComponent, reactive, toRefs } from 'vue';
const tabs = ['A', 'B', 'C'];
export default defineComponent({
  name: 'Example',
  setup() {
    const state = reactive({
      selectedTab: tabs[1]
    });
    return {
      tabs,
      ...toRefs(state)
    };
  }
});

3. Create a custom tabs component.

<template>
  <h3>Custom Example</h3>
  <tabs
    v-model="selectedTab"
  >
    <tab
      v-for="(tab, i) in tabs"
      :key="`t${i}`"
      :val="tab.value"
    >
      <div
        :style="{'border-color': getActive(tab.value) ? tab.color : '', color: getActive(tab.value) ? tab.color : ''}"
        :class="{'active-tab': getActive(tab.value)}"
        class="tab"
      >
        {{ tab.label }}
      </div>
    </tab>
  </tabs>
  <tab-panels
    v-model="selectedTab"
    :animate="true"
    :swipeable="true"
    class="tab-panels"
  >
    <tab-panel
      v-for="(tab, i) in tabs"
      :key="`tp${i}`"
      :val="tab.value"
      class="tab-panel"
      :style="`background: ${tab.color}; color: white;`"
    >
      <div>
        {{ tab.description }}
      </div>
    </tab-panel>
  </tab-panels>
</template>
import { defineComponent, reactive, toRefs } from 'vue';
const tabs = [{
  label: 'Tab 1',
  value: 1,
  description: `Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book`,
  color: 'blue'
}, {
  label: 'Tab 2',
  value: 2,
  description: `It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy`,
  color: 'red'
}, {
  label: 'Tab 3',
  value: 3,
  description: 'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old',
  color: 'grey'
}];
export default defineComponent({
  name: 'Example',
  setup() {
    const state = reactive({
      selectedTab: tabs[0].value
    });
    function getActive(tab: string | number) {
      return state.selectedTab === tab;
    }
    return {
      tabs,
      getActive,
      ...toRefs(state)
    };
  }
});

Touch-enabled Tabs Component, vue3 tabs Plugin/Github


See Demo And Download

Official Website(HJ29): Click Here

This superior jQuery/javascript plugin is developed by HJ29. For extra advanced usage, please go to the official website.

Related Posts

Confetti-Falling-Animation-Effect-party

Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…

jquery-cookie-consent

Simple jQuery Cookie Consent Plugin

jquery.cookie-consent is a simple jQuery plugin to request consent to use cookies. An easy-to-use and highly customizable cookie consent bar that informs your visitors of the use…

Timepicker-Plugin-for-jQuery

Timepicker JavaScript Plugin for jQuery Inspired by Google Calendar

jquery.timepicker is a lightweight jQuery timer plugin inspired by Google Calendar. It supports both mouse and keyboard navigation and weighs 5.5KB minified and compact. Features: Highly customizable…

angular-ngx-carousel-slider

A Lightweight, Touchable, and Responsive Angular Universal Carousel Library

ngxCarousel is a lightweight, tactile, and responsive library for creating an angular carousel. No dependencies, no more hammer. Must Read: Angular Responsive Image Slider With Lightbox Popup…

vue-fullpage-modal

First Mobile Full-screen Modal Popup Library For Vue

Vue full-page modal is a responsive, mobile-compatible, screen-friendly pop-up library for Vue.js. Must Read: Modal Component Is Written in Vanilla JS | ensemble Modal How to make…

random-number-picker

Generate a Random Number Picker In Vanilla JavaScript

Random Number Picker is a Vanilla JS-based number picker that allows you to generate a random number within a specified range. Must Read: Generating Lottery Numbers Using…