MutilineText ​

MutilineText displays long text in a constrained area. When the rendered content exceeds the configured number of rows, the component clamps the text and automatically enables an el-tooltip with the full content.

Basic Usage ​

Set rows to a positive integer to clamp the displayed text. The tooltip is enabled only when the content is actually truncated.

This is a long text that will be clamped to two lines. When the text exceeds the specified number of rows, it will be truncated with an ellipsis and the full content will be shown in a tooltip on hover.

Custom Width ​

Use width or place the component in a constrained container so the text can wrap and clamp correctly.

This is a demonstration of the MultilineText component with different container widths. The text will be clamped based on the rows prop.
This is a demonstration of the MultilineText component with different container widths. The text will be clamped based on the rows prop.

Show Mark ​

Set showMark to display an extra trailing mark in the bottom-right corner after the text is clamped.

This is a long text with the show-mark option enabled. An ellipsis indicator will appear in the bottom-right corner when text is clamped.

Custom Tooltip Content ​

Use the default slot to customize the visible content and the content slot to render custom tooltip content.

This example uses the default slot to customize the visible text style and the content slot to render richer tooltip content when the text is clamped.

Behavior Notes ​

  • rows should be a positive integer. The component calculates the clamp height from the current line height and rows.
  • The tooltip is disabled when the text does not overflow.
  • width controls the rendered text area. If the container width is not constrained, the text may not wrap as expected.
  • default slot replaces the visible text content while preserving the same clamp and overflow behavior.
  • The value prop is used as the default tooltip content. Use the content slot when you need custom tooltip content.
  • When both slots are provided, the visible area comes from default and the tooltip panel comes from content.

API ​

MutilineText Attributes ​

NameDescriptionTypeDefault
valuetext used for the default tooltip content and, when no default slot is provided, the visible contentstring''
rowsnumber of visible lines before clamping; use a positive integernumber0
widthwidth of the rendered text containerstring'unset'
placementtooltip placement passed through to el-tooltipstring'top'
show-markshow an extra trailing mark when the text is clampedbooleanfalse

MutilineText Slots ​

NameDescription
defaultcustom visible content rendered inside the clamped area
contentcustom tooltip content

Source ​

Docs