# Ellipsis

Text ellipsis: multi-line CSS line-clamp is preferred (the row count is driven by the --lh-ellipsis-rows CSS variable), while middle truncation goes through JS (truncateMiddle). It serves the expandable / collapsible, middle-ellipsis and custom-action scenarios (for plain ellipsis keep using the ellipsis of the Text component).

Ellipsis (single line / multi-line / middle / expandable)
<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 is a cross-platform component library family: a two-bloodline architecture, eight repos shipped together, ten docs sites ready — ten repos inside and out.',
  }),
}
</script>

# Controlled expansion (v-model)

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

# Props

Prop Description Type Default
content Text content string —
rows Number of rows shown when collapsed (≥1; invalid values are treated as 1) number 1
expandable Whether it can be expanded (renders the action) boolean false
expanded Expanded state (controlled; self-managed when not passed) boolean —
actionText Action text (falls back to the locale messages ellipsis.expand/collapse) string —
position Ellipsis position (end / middle; middle is single-line only and goes through JS truncation) 'end' \| 'middle' 'end'
ellipsisLabel Accessibility name (falls back to a 40-character summary of the content) string —
sx sx shorthand layout props LhSxProps —

# Events

Event Description Payload
update:expanded Expanded state change (controlled write-back) expanded: boolean
change Expanded state change (action click) expanded: boolean
clickAction The action is clicked (fires together with change) —

# Accessibility

The action is a standalone focusable element (role="button" + tabindex="0", triggered by Enter / Space), and aria-expanded stays in sync with the expanded state.

Last Updated: 12/4/2026, 12:49:57 AM

Copyright © 2024-2026 FengMo WenXue