UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

17 lines (16 loc) 583 B
import { ReactNode } from 'react'; /** * Converts a React node to its string representation by extracting all text content. * * @param node - The React node to convert to text * @returns The text content of the node. Returns an empty string if the node is null, undefined, or boolean. * * @example * ```tsx * reactNodeToText("Hello") // "Hello" * reactNodeToText(42) // "42" * reactNodeToText(<div>Hello World</div>) // "Hello World" * reactNodeToText([<span>A</span>, <span>B</span>]) // "AB" * ``` */ export declare const reactNodeToText: (node: ReactNode) => string;