The `vue-tabs-component` library provides a lightweight and accessible Vue component for effortlessly rendering tabbed interfaces within Vue 2 applications. Currently stable at version 1.5.0, the package sees periodic updates, with recent releases adding features like the `isDisabled` prop for individual tabs (v1.4.0) and an option to control URL fragment usage (v1.2.0). Its key differentiators include built-in persistence of the last-opened tab across page reloads, configurable via a `cache-lifetime` prop, and the ability to link directly to tabs using URL fragments. Importantly, it offers an option (`useUrlFragment: false`) to disable URL fragment modification, crucial for integration with client-side routers or when deploying multiple tab instances. The component is designed with accessibility in mind, adhering to the ARIA specification for tab interfaces, ensuring a robust user experience. It provides flexible registration methods, allowing developers to either register individual components or use it as a Vue plugin.
npm install vue-tabs-componentVerified import paths — ran on the pinned version, not inferred.
Demonstrates global registration and basic usage of the `<tabs>` and `<tab>` components with custom content, event handling, and options.
Pass `:options="{ useUrlFragment: false }"` to the `<tabs>` component to explicitly disable URL fragment modification.Adjust the cache lifetime with the `cache-lifetime` prop (e.g., `<tabs cache-lifetime="0">` to disable persistence, or `<tabs cache-lifetime="15">` for 15 minutes) or ensure your application logic accounts for this behavior.
For plugin-style global registration, use `import VueTabsPlugin from 'vue-tabs-component'; Vue.use(VueTabsPlugin);`. For individual or global component registration using named exports, use `import { Tabs, Tab } from 'vue-tabs-component'; Vue.component('tabs', Tabs); Vue.component('tab', Tab);`Ensure you have `import { Tabs, Tab } from 'vue-tabs-component'; Vue.component('tabs', Tabs); Vue.component('tab', Tab);` in your main JavaScript file, or used the plugin style `import VueTabsPlugin from 'vue-tabs-component'; Vue.use(VueTabsPlugin);`.When using `Vue.use()`, ensure you are importing the default export of `vue-tabs-component`, which acts as the plugin: `import VueTabsPlugin from 'vue-tabs-component'; Vue.use(VueTabsPlugin);`.