Lewati ke konten

Tab Menu - Vue

Tab Menu

banner-background
import { TabVertical } from '@idds/vue';
<template>
  <TabHorizontal
    :items="items"
    :value="value"
    @change="setValue"
    variant="outline"
  />
</template>

<script setup>
import { ref } from 'vue';
import { TabHorizontal } from '@idds/vue';

const value = ref('overview');
const items = ref([
  { value: 'overview', label: 'Overview' },
  { value: 'details', label: 'Details' },
  { value: 'profile', label: 'Profile' },
]);

const setValue = (newValue) => {
  value.value = newValue;
};
</script>

Contoh 3 - Button White Variant with useBrandColor

Section titled “Contoh 3 - Button White Variant with useBrandColor”

TabVertical

NameTypeDefaultRequiredDescription
itemsTabVerticalItem[]YesArray of tab items. Each item has: { value: string, label: string | Component, disabled?: boolean }
value?stringNoCurrently selected tab value (controlled).
defaultValue?stringNoDefault selected tab value (uncontrolled).
onChange?(value: string) => voidNoCallback when tab changes.
size?'sm' | 'md''md'NoSize variant: sm (14px/36px, mobile: 12px/32px) or md (16px/40px, mobile: 14px/36px).
variant?'button-brand' | 'outline' | 'button-white''outline'NoVisual variant of the tabs.
useBrandColor?booleanfalseNoWhether to use brand primary color for outline and button-white variants.
disabled?booleanfalseNoWhether tabs are disabled.
class?string''NoHTML standard class attribute (fallthrough).
containerClassName?string''NoCustom class name for tab container.
tabClassName?string''NoCustom class name for individual tabs.
width?string | number'200px'NoWidth of the vertical tab container.

TabHorizontal

NameTypeDefaultRequiredDescription
itemsTabHorizontalItem[]YesArray of tab items. Each item has: { value: string, label: string | Component, disabled?: boolean }
value?stringNoCurrently selected tab value (controlled).
defaultValue?stringNoDefault selected tab value (uncontrolled).
onChange?(value: string) => voidNoCallback when tab changes.
size?'sm' | 'md''md'NoSize variant: sm (14px/36px, mobile: 12px/32px) or md (16px/40px, mobile: 14px/36px).
variant?'button-brand' | 'outline' | 'button-white''outline'NoVisual variant of the tabs.
fullWidth?booleanfalseNoWhether tabs should fill full width with flex-1.
useBrandColor?booleanfalseNoWhether to use brand primary color for outline and button-white variants.
disabled?booleanfalseNoWhether tabs are disabled.
class?string''NoHTML standard class attribute (fallthrough).
containerClassName?string''NoCustom class name for tab container.
tabClassName?string''NoCustom class name for individual tabs.