Search code examples
javascriptnext.jsantd

Antdesign disable tree tips


Is it possible to disable hover tooltips or customize it?. img

Try global css with next many variations, no result…

I couldn't find anything in the documentation of the antd. The antd selector also has such an element by default.


Solution

  • You just need to change the title to a dom element. title: <>leaf1-nonTooltips</>

    import React from 'react';
    import { Tree } from 'antd';
    import type { TreeDataNode } from 'antd';
    
    const treeData: TreeDataNode[] = [
      {
        title: 'parent 1-0',
        key: '0-0-0',
        disabled: true,
        children: [
          {
            title: <>leaf1-nonTooltips</>,
            key: '0-0-0-0',
            disableCheckbox: true,
          },
          {
            title: 'leaf2-tooltips',
            key: '0-0-0-1',
          },
        ],
      },
    ];
    
    const App: React.FC = () => {
      return <Tree defaultExpandAll treeData={treeData} />;
    };
    
    export default App;