Tooltip in React Progress bar component

25 Mar 202310 minutes to read

Tooltip

The tooltip for the progress bar is used to represent the progress value. During the initial load, it can be enabled by using the enable property. The showTooltipOnHover property can show the tooltip on mouseover.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ProgressBarComponent } from "@syncfusion/ej2-react-progressbar";
function App() {
    return (<ProgressBarComponent id="lineardeterminate" type="Linear" height="60" tooltip={{enable: true}} value={100} animation={{
            enable: true,
            duration: 2000,
            delay: 0
        }}>
          </ProgressBarComponent>);
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("container"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ProgressBarComponent } from "@syncfusion/ej2-react-progressbar";

function App() {
  return(<ProgressBarComponent
                  id="lineardeterminate"
                  type="Linear"
                  height="60"
                  value={100}
                  animation={{
                    enable: true,
                    duration: 2000,
                    delay: 0
                  }}
                  tooltip={{enable: true}}>
          </ProgressBarComponent>
        )
};
export default App;
ReactDOM.render(<App />, document.getElementById("container"));

Format

By default, the tooltip shows information about progress. In addition to that, show more information in the tooltip using the format property.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ProgressBarComponent } from "@syncfusion/ej2-react-progressbar";
function App() {
    return (<ProgressBarComponent id="lineardeterminate" type="Linear" height="60" tooltip={{enable: true, format: "Progress: ${value}"}} value={100} animation={{
            enable: true,
            duration: 2000,
            delay: 0
        }}>
          </ProgressBarComponent>);
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("container"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ProgressBarComponent } from "@syncfusion/ej2-react-progressbar";

function App() {
  return(<ProgressBarComponent
                  id="lineardeterminate"
                  type="Linear"
                  height="60"
                  value={100}
                  animation={{
                    enable: true,
                    duration: 2000,
                    delay: 0
                  }}
                  tooltip={{enable: true, format: "Progress: ${value}"}}>
          </ProgressBarComponent>
        )
};
export default App;
ReactDOM.render(<App />, document.getElementById("container"));

Customization

The fill and border properties are used to customize the background color and border of the tooltip respectively. The textStyle property in the tooltip is used to customize the font of the tooltip text.

import * as React from "react";
import * as ReactDOM from "react-dom";
import { ProgressBarComponent } from "@syncfusion/ej2-react-progressbar";
function App() {
    return (<ProgressBarComponent id="lineardeterminate" type="Linear" height="60" value={100} animation={{
            enable: true,
            duration: 2000,
            delay: 0
        }} tooltip={{
          enable: true,
          textStyle: {
            fontWeight: '600',
            size: '9px',
            color: 'red',
            fontFamily: 'Roboto',
            fontStyle: 'Italic'
          }
        }}>
          </ProgressBarComponent>);
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("container"));
import * as React from "react";
import * as ReactDOM from "react-dom";
import { ProgressBarComponent } from "@syncfusion/ej2-react-progressbar";

function App() {
  return(<ProgressBarComponent
                  id="lineardeterminate"
                  type="Linear"
                  height="60"
                  value={100}
                  animation={{
                    enable: true,
                    duration: 2000,
                    delay: 0
                  }}
                  tooltip={{enable: true,
                    textStyle: {
                      fontWeight: '600',
                      size: '9px',
                      color: 'red',
                      fontFamily: 'Roboto',
                      fontStyle: 'Italic'
                  }}}>
          </ProgressBarComponent>
        )
};
export default App;
ReactDOM.render(<App />, document.getElementById("container"));