Ellipsis
Text truncation: multi-line CSS line-clamp first (rows driven by the --lh-ellipsis-rows CSS variable); position="middle" uses JS truncation (truncateMiddle, uniform across ports). Serves expand/collapse, middle truncation and custom action scenarios.
Platform differences (registered): no platform specialization on this port — end uses -webkit-line-clamp (supported by every port's CSS engine), middle uses the share-core truncateMiddle JS truncation; all truncation and state math reuses share-core pure functions.
Basic usage
vue
<template>
<lh-ellipsis :content="longText" />
<lh-ellipsis :content="longText" :rows="2" />
<lh-ellipsis :content="longText" position="middle" />
</template>
<script setup lang="ts">
const longText = 'lh-ui 是一个跨端组件库家族,双血脉架构,八仓齐发,文档站十站齐备'
</script>Controlled expansion
Passing expanded makes the state controlled (v-model:expanded); change fires on every action click:
vue
<lh-ellipsis :content="longText" :rows="2" expandable v-model:expanded="open" />Props
| Prop | Description | Type | Default |
|---|---|---|---|
| content | Text content | string | — |
| rows | Visible rows when collapsed (>= 1; invalid values fall back to 1) | number | 1 |
| expandable | Render the expand / collapse action | boolean | false |
| expanded | Expanded state (controlled; internal when absent) | boolean | — |
| actionText | Action label (falls back to i18n ellipsis.expand / collapse) | string | — |
| position | Truncation position: end uses CSS line-clamp; middle uses single-line JS truncation | 'end' | 'middle' | 'end' |
| ellipsisLabel | Accessibility label (falls back to a 40-char content summary) | string | — |
| customClass | Custom class (forwarded to the root node) | string | — |
| sx | sx quick layout props | LhSxProps | — |
Events
| Event | Description | Callback |
|---|---|---|
| update:expanded | Expanded state write-back (v-model:expanded) | expanded: boolean |
| change | Expanded state change | expanded: boolean |
| clickAction | Action clicked (fires together with change) | — |
Accessibility
- The action is a standalone focusable node (role="button"); aria-expanded syncs with the expanded state; the root aria-label defaults to a 40-char content summary.

