Tooltip with bold values are not working

When I try to bold the cost value in the following tool tip message, it is coming at the extreme end.

Code:

<TooltipComponent content={'This cost of <b>' + getSymbolFromCurrency(currencyCode) + formatCost(Math.abs(alert.costImpactConstruction), 0, DENOMINATION.auto) + '</b> is estimated for the project'} position="RightCenter">abc</TooltipComponent>


The following is snip of how it appears in UI

This is how it appears in UI


2 Replies

PM Prasanth Madhaiyan Syncfusion Team June 17, 2022 02:27 PM UTC

Hi Aravind,


Greetings from Syncfusion support.


We have validated your reported query by preparing the React Tooltip sample, and we are able to replicate the reported issue while passing the content values as shared in your code. But we need some additional time to further validate and identify the root cause of this issue. We will update you with further details on or before June 22, 2022.


We appreciate your patience.


Regards,

Prasanth Madhaiyan.



IL Indhumathy Loganathan Syncfusion Team June 21, 2022 11:13 AM UTC

Hi Aravind,


Thanks for your patience.


We have validated your reported query. The reported issue occurs when we use HTML tags such as bold or span directly, it automatically moves the element to the end of that string. However, you can directly set the HTML elements as Tooltip content by following the below way. Check the below code snippet.


getSymbolFromCurrency(args) {

  return (

    <p>

      Hello <b>$0</b> is estimated for the project.

    </p>

  );

}

...

render() {

  return (

    <div className="control-pane">

      <div className="control-section row">

        <div className="col-lg-8" style={{ minHeight: '350px' }}>

          {/* Tooltip element */}

          <TooltipComponent

            content={this.getSymbolFromCurrency}

            position={this.state.position}


Sample: https://stackblitz.com/edit/react-swdhdk-lmpcfm?file=index.js


Documentation: https://ej2.syncfusion.com/react/documentation/tooltip/content/#template-content


Else, you can use our beforeRender event to set the Tooltip content dynamically as done in the below documentation.


https://ej2.syncfusion.com/react/documentation/tooltip/content/#dynamic-content-via-ajax


Please check whether the shared solution meets your requirement and get back to us if you need any further assistance.


Regards,

Indhumathy L


Loader.
Up arrow icon