@tag0/use-text-width
Version:
React hook to measure text width
14 lines (13 loc) • 370 B
TypeScript
import { RefObject } from "react";
type useTextWidthTextOptions = {
text: string | string[] | undefined;
font?: string;
};
type useTextWidthRefOptions = {
ref: RefObject<Element>;
};
interface useTextWidthType {
(options: useTextWidthTextOptions | useTextWidthRefOptions): number;
}
declare const useTextWidth: useTextWidthType;
export { useTextWidth };