Skip to content
API 风格:

IndexBar 인덱스 바 ​

주소록식 인덱스 바: 우측 알파벳 인덱스 + 그룹 앵커 이동을 제공합니다. scroll-spy 활성화 환산(resolveActiveIndex)과 터치 환산(hitIndexBar)은 모두 @lh-ui/share/core/index-bar 순수 로직을 소비하며, 이 플랫폼은 DOM 측정 + scrollTo 연결만 담당합니다.

기본 사용법 ​

인덱스 바(클릭 / 터치로 그룹 이동)

현재 인덱스:

vue
<script setup lang="ts">
import { ref } from 'vue'
import { LhIndexBar, LhIndexBarGroup, LhIndexBarItem } from '@lh-ui/vue3'

const current = ref('')
const groups: Record<string, string[]> = {
  A: ['아바이', '아황'],
  B: ['백주', '박하'],
  C: ['춘일', '춘'],
}

function onSelect(index: string) {
  current.value = index
}
</script>

<template>
  <LhIndexBar :index-list="['A', 'B', 'C']" @select="onSelect">
    <LhIndexBarGroup v-for="key in ['A', 'B', 'C']" :key="key" :index="key">
      <LhIndexBarItem v-for="name in groups[key]" :key="name">{{ name }}</LhIndexBarItem>
    </LhIndexBarGroup>
  </LhIndexBar>
</template>

상단 고정과 커스텀 강조 ​

sticky로 그룹 헤더를 상단에 고정합니다(기본 켜짐). sticky-offset-top은 내비게이션 바 자리 확보용 오프셋, highlight-color는 활성 인덱스 강조 색상을 커스터마이징합니다.

상단 고정 + 커스텀 강조 색상

API ​

IndexBar Props ​

속성설명타입기본값
index-list인덱스 항목 배열(미전달 시 기본 A-Z 26항목; 빈 배열이면 측면 바 없이 렌더링)string[]A-Z
sticky앵커 그룹 헤더 상단 고정booleantrue
sticky-offset-top상단 고정 오프셋 px(내비게이션 바 자리 확보용)number0
highlight-color활성 인덱스 강조 색상(미전달 시 indexBar.highlightColor 토큰 사용)string—

IndexBar Events ​

이벤트설명콜백 매개변수
select측면 바 인덱스 항목 클릭 / 터치index: string

IndexBar Slots ​

슬롯설명페이로드
default그룹 내용(LhIndexBarGroup / LhIndexBarItem 쌍)—
item인덱스 항목 커스텀 렌더링{ index }

IndexBarGroup Props ​

속성설명타입기본값
index그룹 인덱스 키(indexList 항목과 정렬)string—

IndexBarItem Props ​

속성설명타입기본값
disabled비활성화(대비 감소)booleanfalse

IndexBarItem Slots ​

슬롯설명
default항목 내용

국풍의 아름다움으로 코드의 토대를 세웁니다