Skip to content

Tab

ETab is a collection of tab elements pointing to a separate content section or view. The tab bar organizes material across several displays and allows you to navigate between subsections. Demo Here

Usage

The ETab, ETabItem and ETabContent components are used together as below:

vue
// In this approach the ETabItem and ETabContent are linked together based on
their order.

<template>
  <ETab v-model="activeTab">
    <template #tabItems>
      <ETabItem> Item 1</ETabItem>
      <ETabItem> Item 2</ETabItem>
    </template>
    <template #tabContent>
      <ETabContent> Content 1</ETabContent>
      <ETabContent> Content 2</ETabContent>
    </template>
  </ETab>
</template>

<script setup>
  const activeTab = ref(0);
</script>
vue
// In this approach the `ETabItem` and `ETabContent` are linked together based
on their custom value.

<template>
  <ETab v-model="activeTab">
    <template #tabItems>
      <ETabItem value="first"> Item 1</ETabItem>
      <ETabItem value="second"> Item 2</ETabItem>
    </template>
    <template #tabContent>
      <ETabContent value="first"> Content 1</ETabContent>
      <ETabContent value="second"> Content 2</ETabContent>
    </template>
  </ETab>
</template>

<script setup>
  const activeTab = ref("second");
</script>

Props

  • For ETab component, the following props are available:
PropTypeDefaultNote
modelValue[String, Number]-Controls selected tab.
verticalBooleanfalseIt organizes your tabs vertically.
squareBooleanfalseRemoves rounded corners of the element.
growBooleanfalseMakes the tab items expand to fit the full container width.
alignString"start"Specifies how the tab items are distributed along the cross axis in a container.
stackedBooleanfalsePlaces an icon and text of the ETabItem behind each other on one line vertically.
variantString"fill"The ETab element can be represented in three ways: fill, alternate. alternate displays the chip with a light background.
colorString"primary"The given color is applied to the tab - utility colors are supported (e.g primary or danger). you'll find a list of built-in classes on the src/styles/_vars.scsspage.
headerClassesString-Overrides or extends the header styles.
  • For ETabItem component, the following props are available:
PropTypeDefaultNote
valueBooleanfalseAdds a unique value to each tab bar.
variantString"fill"The ETab element can be represented in three ways: fill, alternate. alternate displays the chip with a light background.
iconObject-By using icon prop the ETabItem element will be visualized with an Icon. More Info about icons here.
idString-HTML id attribute.
colorString"primary"The given color is applied to the tab - utility colors are supported (e.g primary or danger). you'll find a list of built-in classes on the src/styles/_vars.scsspage.
stackedBooleanfalsePlaces an icon and text of the ETabItem behind each other on one line vertically.
  • For ETabContent component, the following props are available:
PropTypeDefaultNote
valueBooleanfalseAdds a unique value to each tab bar.
idString-HTML id attribute.

Emits

The ETab component contains following emits.

EmitDescription
update:modelValueEmitted when the local ref's value is mutated.

Slots

The ETab component provide following slots that enable you to customize the content.

SlotDescription
tabItemsThe slot used for the ETabItem element.
tabContentThe slot used for the ETabContent element.

The ETabItem and ETabContent components provide a default slot that enable you to customize the content.

SlotDescription
defaultThe default Vue slot.

COPYRIGHT