UNPKG

@chayns-components/core

Version:

A set of beautiful React components for developing your own applications with chayns.

18 lines 442 B
import { isValidElement } from 'react'; export const isTextOnlyElement = element => { if (typeof element === 'string') { return true; } if (! /*#__PURE__*/isValidElement(element)) { return false; } const validTags = ['p', 'span', 'div']; if (!validTags.includes(element.type)) { return false; } const { children } = element.props; return typeof children === 'string'; }; //# sourceMappingURL=tooltip.js.map