Text provides overflow handling. It renders a div by default and inherits typography from its surroundings.
Truncate one line
Give the text a constrained width, then settruncate to show an ellipsis when it overflows:
Limit the number of lines
UselineClamp with a positive integer. Choose either truncate or lineClamp; their props are mutually exclusive.
Choose an element
Userender when the text needs another semantic element:
Props
Native attributes, children, refs, class names, and styles are also accepted.number
Maximum number of lines before the text is truncated with an ellipsis.
Cannot be combined with
truncate.ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>
Allows you to replace the component’s HTML element
with a different tag, or compose it with another component.Accepts a
ReactElement or a function that returns the element to render.boolean
Truncates overflowing text on one line with an ellipsis. Cannot be
combined with
lineClamp.