# Ellipsis 텍스트 생략

텍스트 생략: 여러 줄의 CSS line-clamp를 우선합니다(줄 수는 --lh-ellipsis-rows CSS 변수로 구동), middle 중간 생략은 JS 잘라내기(truncateMiddle)를 사용합니다. '펼치기 / 접기, 중간 생략, 사용자 정의 action' 시나리오를 서비스합니다 (단순 생략은 Text 컴포넌트의 ellipsis를 계속 사용).

텍스트 생략 (한 줄 / 여러 줄 / middle / 펼치기 가능)
<template>
  <div class="demo-col" style="gap: 18px; max-width: 360px">
    <LhEllipsis :content="longText" />
    <LhEllipsis :content="longText" :rows="2" />
    <LhEllipsis :content="longText" position="middle" />
    <LhEllipsis :content="longText" :rows="2" expandable />
  </div>
</template>

<script>
export default {
  data: () => ({
    longText: 'lh-ui는 크로스 플랫폼 컴포넌트 라이브러리 패밀리로, 두 혈통 아키텍처로 8개 저장소가 동시에 전개되었고 문서 사이트 10개를 갖추었으며 안팎으로 총 10개 저장소입니다.',
  }),
}
</script>

# 제어 펼치기(v-model)

<LhEllipsis
  v-model:expanded="open"
  :content="longText"
  :rows="2"
  expandable
  @change="onChange"
/>

# Props

프로퍼티 설명 타입 기본값
content 텍스트 콘텐츠 string —
rows 접힌 상태에서 표시할 줄 수 (1 이상, 잘못된 값은 1로 간주) number 1
expandable 펼치기 가능 여부 (action 렌더링) boolean false
expanded 펼친 상태 (제어; 미전달 시 비제어로 자체 관리) boolean —
actionText action 텍스트 (미전달 시 언어 패키지 ellipsis.expand/collapse 사용) string —
position 생략 위치 (end / middle; middle은 한 줄만, JS 잘라내기 사용) 'end' \| 'middle' 'end'
ellipsisLabel 접근성 이름 (미전달 시 콘텐츠 앞 40자 요약 사용) string —
sx sx 레이아웃 단축 속성 LhSxProps —

# Events

이벤트 설명 페이로드
update:expanded 펼친 상태 변화 (제어 되돌려 쓰기) expanded: boolean
change 펼친 상태 변화 (action 클릭) expanded: boolean
clickAction action 클릭 (change와 동시) —

# 접근성

action은 독립적인 포커스 가능 요소(role="button" + tabindex="0", Enter / Space로 트리거)이며, aria-expanded가 펼친 상태와 동기화됩니다.

최근 업데이트: 2026. 12. 4. 오전 12:49:57

Copyright © 2024-2026 FengMo WenXue