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
rowsshould be a positive integer. The component calculates the clamp height from the current line height androws.- The tooltip is disabled when the text does not overflow.
widthcontrols the rendered text area. If the container width is not constrained, the text may not wrap as expected.defaultslot replaces the visible text content while preserving the same clamp and overflow behavior.- The
valueprop is used as the default tooltip content. Use thecontentslot when you need custom tooltip content. - When both slots are provided, the visible area comes from
defaultand the tooltip panel comes fromcontent.
API
MutilineText Attributes
| Name | Description | Type | Default |
|---|---|---|---|
| value | text used for the default tooltip content and, when no default slot is provided, the visible content | string | '' |
| rows | number of visible lines before clamping; use a positive integer | number | 0 |
| width | width of the rendered text container | string | 'unset' |
| placement | tooltip placement passed through to el-tooltip | string | 'top' |
| show-mark | show an extra trailing mark when the text is clamped | boolean | false |
MutilineText Slots
| Name | Description |
|---|---|
| default | custom visible content rendered inside the clamped area |
| content | custom tooltip content |