UNPKG

react-truncate-inside

Version:

React component for adding an ellipsis to the middle of a line of text.

29 lines (28 loc) 811 B
import * as React from 'react'; export interface TruncateProps { /** text to be truncated */ text: string; /** width of the element @default parentNode.width */ width?: number; /** the position(from the end) of the ellipsis that shows in text @default 8 */ offset?: number; /** Ellipsis that is added into the text in case it is truncated @default ... */ ellipsis?: string; } /** * <b>Truncate</b> truncates text based on a given width. The component takes in a few props, including the text to be truncated, the width of the container, the number of characters to offset the truncated text, and the ellipsis to be used. */ declare function Truncate(props: TruncateProps): React.JSX.Element; export default Truncate;