Components
LongText
Utility component for truncating long text with tooltip and popover support.
Overview
LongText automatically truncates overflowing text using CSS truncate.
When the content overflows:
- Desktop → shows the full content inside a
Tooltip - Mobile → shows the full content inside a
Popover
Useful for:
- Tables
- Cards
- Lists
- Descriptions
- Any layout with limited width
Examples
Basic Usage
Usage
Custom Styling
Table Example
Props
| Prop | Type | Description |
|---|---|---|
children | React.ReactNode | Text or content to render inside the component. |
className | string | Additional class names applied to the truncated container. |
contentClassName | string | Additional class names applied to the tooltip/popover content. |
Behavior
| Screen Size | Interaction |
|---|---|
Desktop (sm and above) | Displays full text using Tooltip |
Mobile (< sm) | Displays full text using Popover |
Notes
- The component only enables tooltip/popover when the content is actually overflowing.
- Overflow detection is based on element
scrollWidth/offsetWidth. - Works best when the parent container has a constrained width.
How is this guide?