UNPKG

tsuite

Version:

A collection of useful utility functions, All fully typed and documented

26 lines 994 B
//#region src/hug-text.d.ts /** * Adjusts the width of a given element to fit its text content without increasing its height. * * @param input - The element to adjust. */ /** * Shrinks the width of the given HTML element(s) until the text wraps to a new line, * then restores the width to the minimum value that fits the text on a single line. * * This function is useful for "hugging" text content by reducing the element's width * to the smallest possible value before the content overflows or wraps. * * @param input - The target element(s) to adjust. Accepts a single HTMLElement, * a NodeList, an HTMLCollection, or an array of HTMLElements. * @throws {Error} If the input is not provided or is not a valid type. * * @example * ```typescript * const element = document.getElementById('my-text'); * hugText(element); * ``` */ declare function hugText(input: HTMLElement | NodeList | HTMLCollection | HTMLElement[]): void; //#endregion export { hugText };