UNPKG

@yukimoto/use-clamp-text

Version:

This package provide a custome hook that can limit the text in the container in specified line number.

25 lines (24 loc) 910 B
/// <reference types="react" /> interface ClampTextconfig { originalText: string; lines?: number; debounceTime?: number; minSpaceCharNum?: number; unitSpaceChar?: string; endSpaceNumber?: number; } interface Refs { WrapperContainer: HTMLElement; AddonsContainer: HTMLElement; TextContainer: HTMLElement; } export declare const useClampText: <RF extends Refs>({ originalText, lines, debounceTime, minSpaceCharNum, unitSpaceChar, endSpaceNumber, }: ClampTextconfig) => { readonly longEnoughToClamp: boolean; readonly clamped: boolean; readonly clampedText: string; readonly toggleClamp: () => void; readonly wrapperContainerRef: import("react").RefObject<RF["WrapperContainer"]>; readonly textContainerRef: import("react").RefObject<RF["TextContainer"]>; readonly addOnsContainerRef: import("react").RefObject<RF["AddonsContainer"]>; }; export {};