How can I render raw HTML in the Placeholder for an SfTextBox

Hello,


I am trying to show the accesskey as underlined by applying a style to the Placeholder text as follows:

<SfTextBox @bind-Value="@name"

                                   Placeholder="<span class='button__accesskey''>N</span>ame"

                                   accesskey="n"

                                   FloatLabelType="FloatLabelType.Always"

                                   ShowClearButton="true" />


However, the component renders the Placeholder text as a literal string. If I try to cast the string to MarkupText I get an error when compiling saying that it can't be converted to a string.


Please advise how I can include HTML in the Placeholder property.


Thanks,


Chuck


3 Replies

PM Ponmani Murugaiyan Syncfusion Team February 28, 2022 04:07 PM UTC

Hi Chuck, 

By default, the placeholder property is string type it cannot accept the markup string. We have compared with native Blazor InputText and the native TextBox also have same behaviour. Please find the sample below for reference. 


Regards, 
Ponmani M  



CR Chuck Richardson March 4, 2022 11:04 PM UTC

Thank you for the explanation. We will find another solution to our needs. Thanks, Chuck



PM Ponmani Murugaiyan Syncfusion Team March 7, 2022 05:53 AM UTC

Hi Chuck, 

Thanks for the update. If you need further assistance, please get back us. 

Regards, 
Ponmani M 


Loader.
Up arrow icon