I use a TextInput and I would like to highlight certain part of that text.
For example if the user's name is inside that text input I want it blue,but all the other words I want it to be black.
I tried different options but all operate to the whole text of a text input.
Thank you in advance,
This is not supported on the Text Input control. If you feel that this feature is important for your scenario, please create a new item in the PowerApps Ideas board, with details about your scenario.
If you want to format a control that displays text (not letting the user input it), you can use the HTML Text control, where you can control, via HTML tags, the color of parts of the text.
You might be able to get creative using a TextInput AND the HTML text, actually...
I did this as a quick test --
TextInput1 - I typed in "Hey Nick!"
TextInput1.OnChange = Set(stuff,TextInput1.Text)
HTMLtext1.HTMLtext = Substitute(stuff,"Nick","<b>Nick</b>")
So then HTMLtext1 reads Hey Nick!
I don't know if that's helpful or not.
hi @StellaTs - Just curious to know if you were you able to figure out a workaround to this requirement as I have the similar requirement?
I know this is an old post, but I found this was a great solution - I modified slightly with some HTML encoding and worked really well for me.
["<span style='background-color: #000000; color: #ffffff;'>",TextInput1.Text,"</span>"]
I wanted to highlight text in fields as the text was typed into a search box. It took awhile, but I settled on using an HTMLTextBox and setting the HTMLText property to a value that substituted the search text with a highlighted version of the text. I also set the gallery Items property to filter the gallery by search text as it was typed using
The code is:
The search function does a case insensitive search for the entered text in the specified fields.
This code highlights the search text in this field using the HTML5 <mark> tag.
It is nested so it first substitutes the exact search box text in the field Text.
Then it takes that text and substitutes all lower case occurrences of the search text.
Then it takes that text and substitutes all upper case occurrences of the search text.
Then it takes that text and substitutes all title (Proper) case occurrences of the search text.
The result is that all occurrences of the search text are highlighted except for miXEd text.
"<mark>" & SearchBox1_2.Text & "</mark>"
"<mark>" & Lower(SearchBox1_2.Text) & "</mark>"
"<mark>" & Upper(SearchBox1_2.Text) & "</mark>"
"<mark>" & Proper(SearchBox1_2.Text) & "</mark>")
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.