I want to Highlight not Select part of the value in TextField
component
Something like this
I tried having a <span>
with a class in the value prop but that showed [object Object]
instead.
How can I achieve that?
I want to Highlight not Select part of the value in TextField
component
Something like this
I tried having a <span>
with a class in the value prop but that showed [object Object]
instead.
How can I achieve that?
Material UI Textfield component is basically made up of a html input component.
the Textfield "value" prop will be reflected as html input element's value
Yes, it is possible to highlight, but we need to pre-parse the text in to html,
Warning!! Must be careful about the source of the text.
npm install html-react-parser
var parse = require('html-react-parser');
<Typography > {parse(props.text)}</Typography>
Example: props.text = "This should render your html"