paragon
paragon copied to clipboard
`Truncate` causes a JS error if a non-string child is passed
https://paragon-openedx.netlify.app/components/truncate/
In Truncate
, children
is expected to be a string.
However, by not supporting any type (string, node, etc.), we run the risk of having the component being flexible enough for consumers' use cases.
For example, if a consumer wants to bold some text in the paragraph of truncated text, they would not be able to in the current implementation.
![image](https://user-images.githubusercontent.com/2828721/185613934-e6e464c8-26e6-4f7d-9b5f-cc79bf23f78b.png)
Is there a way around this to have Truncate
support HTML/React elements in its children
? It looks like react-truncate
also supports flexible children
, maybe as inspiration.