Components · Typography
Truncate
AlphaAdded v10.7.0
Text clipped to one or more lines, with the full text in a tooltip only while it is clipped.
import { Truncate } from '@nexub/react';Playground
Props
Quarterly infrastructure invoice for the Singapore and Frankfurt regions
<Truncate>Quarterly infrastructure invoice for the Singapore and Frankfurt regions</Truncate>Examples
Default
Several lines
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| lines | number | 1 | Lines shown before the text is clipped. |
| as | React.ElementType<any, keyof React.JSX.IntrinsicElements> | 'span' | The element to render. |
| tooltip | boolean | true | Show the full text in a tooltip while it is clipped. Needs string children. |
Accessibility
Notes
Clipped text is a tab stop, so keyboard users can read the tooltip. Text that fits adds no tab stop and no tooltip.
The tooltip needs string children; other children are clipped only.
On iOS & Android
Web only
Truncate has no @nexub/react-native twin. On phones, follow the platform pattern instead, or compose it from the native components listed on the React Native page.