# @frankhoodbs/tabs-cmp

> Tabs component

Latest version **5.0.0** (published 2026-03-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install @frankhoodbs/tabs-cmp
pnpm add @frankhoodbs/tabs-cmp
yarn add @frankhoodbs/tabs-cmp
bun add @frankhoodbs/tabs-cmp
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2026-03-04 |
| First published | 2023-10-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 5 |
| Unpacked size | 26.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Frankhood Business Solutions s.r.l. |
| Maintainers | giando110188, frankhood-info, skill83, m.brandonisio |

## Links

- npm: https://www.npmjs.com/package/@frankhoodbs/tabs-cmp
- npm.io page: https://npm.io/package/@frankhoodbs/tabs-cmp

## Dependencies (5)

- [vue](https://npm.io/package/vue.md) ^3.5.29
- [@frankhoodbs/slot-helper](https://npm.io/package/@frankhoodbs/slot-helper.md) ^5.0.0
- [@frankhoodbs/a11y-support](https://npm.io/package/@frankhoodbs/a11y-support.md) ^5.0.0
- [@frankhoodbs/cast-prop-to-type](https://npm.io/package/@frankhoodbs/cast-prop-to-type.md) ^5.0.0
- [@frankhoodbs/scroll-x-navbar-cmp](https://npm.io/package/@frankhoodbs/scroll-x-navbar-cmp.md) ^5.0.0

## Recent versions

- 5.0.0 (latest) — 2026-03-04
- 4.0.8 — 2025-11-28
- 4.0.7 — 2025-11-28
- 4.0.6 — 2025-11-27
- 4.0.5 — 2025-11-26
- 4.0.4 — 2025-11-19
- 4.0.3 — 2025-11-12
- 4.0.2 — 2025-11-06
- 4.0.1 — 2025-11-06
- 4.0.0 — 2025-10-24
- 3.0.7 — 2025-09-04
- 3.0.6 — 2025-09-04
- 3.0.5 — 2025-09-03
- 3.0.4 — 2025-07-17
- 3.0.3 — 2025-06-04
- … 43 more at https://npm.io/package/@frankhoodbs/tabs-cmp/versions

## README

# Tabs Component

An accessible tabs utility wrapper.

Un utility wrapper per tabs accessibili.

![Version](https://img.shields.io/npm/v/@frankhoodbs/tabs-cmp)
![License](https://img.shields.io/npm/l/@frankhoodbs/tabs-cmp)

## API Reference

#### Slots

| Name                 | Description                                                                                                                                                                                                                                                                                                                                                                     |
|:---------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tablist-heading`    | Slot for the heading above the tabs navigation. Used for accessibility, remember to put an id on the tag passed inside and to pass his value in the data-tablist-id props as reference for the aria-labelledby. If you don't pass any heading remember to pass the data-aria-label props.                                                                                       |
| `tablist`            | Slot for the tabs navigation. If passed remember to put the class `tabs` on the tablist wrapper if you want a working animation of the tabpanel, follow this as reference for implementation (https://www.w3.org/WAI/ARIA/apg/patterns/tabs/); If not passed a default navigation is rendered using the package https://www.npmjs.com/package/@frankhoodbs/scroll-x-navbar-cmp. |
| `tabpanel-${tab.id}` | **Required**. Slots for every tab content.                                                                                                                                                                                                                                                                                                                                      |

#### Props

| Name                      | Type              | Description                                                                                                              |
|:--------------------------|:------------------|:-------------------------------------------------------------------------------------------------------------------------|
| `data-id-prefix`          | `string`          | **required** Prefix for all the id attributes.                                                                           |
| `data-tablist-heading-id` | `string`          | The id of the slotted heading tag. If no heading is slot, pass data-tablist-aria-label instead.                          |
| `data-tablist-aria-label` | `string`          | The aria-label of the tablist. Needed only if no heading is slot.                                                        |
| `data-tabs`               | `Tab[] or string` | **Required** Tabs list                                                                                                   |
| `data-active-tab-id`      | `string`          | **Required** Id of the active tab.                                                                                       |
| `data-tabs-overlap`       | `'down' or 'up'`  | If passed indicates that each tab has a z-index greater or lower than the previous one.                                  |
| `data-transition-name`    | `string`          | Name of the animation to use, currently only `fade` is available. You can disable the animation passing an empty string. |

#### Tab interface

| name             | Type      | Description |
|:-----------------|:----------|:------------|
| `id`             | `string`  | Tab id      |
| `label`          | `string`  | Tab label   |

#### Methods

| name            | Params                                                                            | Description                                                                                                                 |
|:----------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------|
| `handleKeydown` | event: KeyboardEvent, activeTabId: string, tablist: Tab[], $tabRef: HTMLElement[] | You can use this method from outside to achieve the accessibility behavior of moving through the tabs with keyboard arrows. |

#### CSS variables

| Name                              | default | Description                                                |
|:----------------------------------|:--------|:-----------------------------------------------------------|
| `--tabs-heading-padding`          |         | Padding of the heading above the navigation bar            |
| `--tabs-tab-label-outline-width`  |         | Outline width of the :focus-visible tab                    |
| `--tabs-tab-label-outline-color`  |         | Outline color of the :focus-visible tab                    |
| `--tabs-tab-label-outline-offset` |         | Outline offset of the :focus-visible tab                   |
| `--tabs-tabpanel-wrapper-padding` |         | Padding of the tabpanel wrapper below the navigation bar   |
| `--tabs-tabpanel-padding`         |         | Padding of the tabpanel inside the tabpanel wrapper        |
| `--tabs-tabpanel-outline-width`   |         | Outline width of the tabpanel inside the tabpanel wrapper  |
| `--tabs-tabpanel-outline-color`   |         | Outline color of the tabpanel inside the tabpanel wrapper  |
| `--tabs-tabpanel-outline-offset`  |         | Outline offset of the tabpanel inside the tabpanel wrapper |

## Usage/Examples

```vue
<tabs-cmp
  data-id-prefix="TabsCmp-1"
  data-tablist-heading-id="TabsCmp-1-tablist-heading"
  :data-active-tab-id="activeTabId"
  :data-tabs="[
    { id: '1', label: 'Frozen Multi-portion Pasta' },
    { id: '2', label: 'Frozen Short Pasta' },
    { id: '3', label: 'Frozen Filled Pasta' },
    { id: '4', label: 'Frozen Egg Pasta' },
  ]"
  data-tabs-overlap="down"
  @update="activeTabId = $event"
>
  <template #tablist-heading>
    <h3 id="TabsCmp-1-tablist-heading" class="pb-7">Accessible Tablist</h3>
  </template>
  <template #tabpanel-1>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci
    architecto beatae cupiditate, dicta error est illo itaque minus natus
    numquam quaerat reprehenderit, repudiandae soluta! Adipisci amet
    aspernatur ducimus, eos expedita inventore ipsam. Ad adipisci amet
    assumenda at corporis dicta eius enim ex facilis fugit incidunt ipsam
    laborum necessitatibus quam, quia quibusdam quidem quis quo recusandae rem
    repellendus reprehenderit repudiandae sed tempore unde veniam vero vitae!
    Ad aliquid, animi asperiores consequatur deleniti ea eligendi harum nam
    pariatur quia quibusdam ratione reprehenderit rerum temporibus veritatis!
    Ab consectetur dolorum, error eveniet, ex facere hic ipsum labore libero
    nihil quaerat quidem quod repellat suscipit.
  </template>
  <template #tabpanel-2>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium,
    enim?
  </template>
  <template #tabpanel-3>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dicta
    dolor enim mollitia quam temporibus ut. Aliquid, architecto asperiores,
    consequatur doloremque eaque magnam minus nam neque numquam odit
    reiciendis sed, voluptas voluptatem. Assumenda consectetur culpa eum iusto
    non reiciendis, rem!
  </template>
  <template #tabpanel-4>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium,
    enim?
  </template>
</tabs-cmp>

const activeTabId = ref<string>('1');
```

## Screenshots

![Component Screenshot](https://i.imgur.com/uWEQpgp.png)

---
_Source: https://npm.io/package/@frankhoodbs/tabs-cmp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
