Pass the truncated prop to render an ellipsis when the text exceeds the width of the viewport or max-width set. line-clamp prop to render multiline ellipsis.
Self element set width 100px
Squeezed by parent element
The -webkit-line-clamp CSS property allows limiting of the contents of a block to the specified number of lines.
Show tooltip only when the text is truncated
export function TextTruncated() {
return (
<>
<ElText className={`${styles.w150} ${styles.mb2}`} truncated>
Self element set width 100px
</ElText>
<ElRow className={`${styles.row} ${styles.w150}`}>
<ElText truncated>Squeezed by parent element</ElText>
</ElRow>
<ElRow className={styles.row}>
<ElText lineClamp={2}>
The -webkit-line-clamp CSS property
<br />
allows limiting of the contents of
<br />a block to the specified number of lines.
</ElText>
</ElRow>
<ElRow>
<ElText className={styles.w150} truncated>
Show tooltip only when the text is truncated
</ElText>
</ElRow>
</>
);
}
Override
Use attribute tag to override element
span
This is a paragraph.
Bold
Italic
This is subscript
This is superscript
Inserted
Deleted
Marked
export function TextOverride() {
return (
<ElSpace direction="vertical">
<ElText>span</ElText>
<ElText tag="p">This is a paragraph.</ElText>
<ElText tag="b">Bold</ElText>
<ElText tag="i">Italic</ElText>
<ElText>
This is{" "}
<ElText tag="sub" size="small" className={styles.sub}>subscript</ElText>
</ElText>
<ElText>
This is{" "}
<ElText tag="sup" size="small" className={styles.sup}>superscript</ElText>
</ElText>
<ElText tag="ins">Inserted</ElText>
<ElText tag="del">Deleted</ElText>
<ElText tag="mark">Marked</ElText>
</ElSpace>
);
}