Tooltip
Description
Tooltip helperUsage
Tooltip: Component<{ content?: Component<{ data: ITask }>; api?: IApi; () => any }>;
You can import the component from "@svar-ui/react-gantt".
Parameters
content- (optional) the React component that includes:data- (required) the tasks objectapi- (required) the API gateway object for interacting with Gantt API
If the attribute is not added, then the tooltip will display the task name.
Example
The example below shows how to add the default tooltip. Do not forget to pass the api object to Tooltip (for more details, refer to How to access Gantt API). Other usage examples see here: Adding tooltips
import { useRef } from "react";
import { getData } from "../data";
import { Gantt, Tooltip } from "@svar-ui/react-gantt";
function MyGantt() {
const data = getData();
const apiRef = useRef(null);
return (
<Tooltip api={apiRef.current}>
<Gantt
tasks={data.tasks}
links={data.links}
scales={data.scales}
ref={apiRef}
/>
</Tooltip>
);
}
export default MyGantt;
Related articles: