WlTabs

Tabs with keyboard navigation. Each tab's content is supplied in the scoped panel slot.
Components / Containers v0.1.0

Placement

Material description.

Full example
<div class="wl-stack" data-space="md">
  <WlTabs v-model="active" :items="items" >
    <template #panel="{ item }">
      <p :id="`${prefix}-${item.key}`" class="wl-text-body">
        {{ item.key === 'example-overview' ? "Material description." : "Material updated October 1." }}
      </p>
    </template>
  </WlTabs>
</div>

Behavior

Material description.

Full example
<div class="wl-stack" data-space="md">
  <WlTabs v-model="active" :items="items" >
    <template #panel="{ item }">
      <p :id="`${prefix}-${item.key}`" class="wl-text-body">
        {{ item.key === 'example-overview' ? "Material description." : "Material updated October 1." }}
      </p>
    </template>
  </WlTabs>
</div>

Tabs with icons and panels

Controlled model, note count, scoped panel and keyboard section switching.

Overview

Drawer showcase-overview receives content from the scoped slot.

←/→, Home and End switch tabs.

Active tab: Overview.

Full example
<script setup lang="ts">
import { WlButton, type WlTabItem, WlTabs } from "legato-ui";
import { computed, ref } from "vue";
const active = ref("showcase-overview");
const count = ref(3);
const items = computed<WlTabItem[]>(() => [{ key: "showcase-overview", label: "Overview", icon: "file" }, { key: "showcase-notes", label: "Notes", icon: "edit", count: count.value }, { key: "showcase-history", label: "History", icon: "clock" }]);
</script>

<template>
  <div class="wl-stack" data-space="lg">
    <WlTabs v-model="active" :items="items" :pt="{ tabList: { 'aria-label': 'Material sections' } }">
      <template #panel="{ item }">
        <div class="wl-stack" data-space="md">
          <h3 class="wl-text-subheading">{{ item.label }}</h3>
          <p class="wl-text-body">
            {{ "Drawer" }} {{ item.key }} {{ "receives content from the scoped slot." }}
          </p>
          <div v-if="item.key === 'showcase-notes'">
            <WlButton size="sm" @click="count++">{{ "New note" }}</WlButton>
            <p class="wl-text-small">{{ "Notes in the local example:" }} {{ count }}</p>
          </div>
          <p v-else class="wl-text-small wl-text-muted">
            {{ item.key === 'showcase-history'
              ? "Today — documentation reviewed."
              : "←/→, Home and End switch tabs." }}
          </p>
        </div>
      </template>
    </WlTabs>
    <p class="wl-text-small" role="status">{{ "Active tab:" }} {{ items.find(item => item.key === active)?.label }}.</p>
  </div>
</template>