Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Antd react customize directrory tree node background?

How to change the default background color of antd directory tree node when mouseover the tree node using less styles ?


 <Tree.DirectoryTree>
        {data.map((item) => {
          return (
            <Tree.TreeNode
              // @ts-ignore
              item={item}
              icon={<></>}
              key={item.user_folder_id}
              title={item.title}
            >
              {item?.data.map((node) => {
                return (
                  <Tree.TreeNode
                    node={node}
                    key={node.node_id}
                    title={ node.title }
                  ></Tree.TreeNode>
                );
              })}

            </Tree.TreeNode>
          );
        })}
      </Tree.DirectoryTree>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

 <Tree.DirectoryTree className="custom-tree">
        {data.map((item) => {
          return (
            <Tree.TreeNode
              // @ts-ignore
              item={item}
              icon={<></>}
              key={item.user_folder_id}
              title={item.title}
            >
              {item?.data.map((node) => {
                return (
                  <Tree.TreeNode
                    node={node}
                    key={node.node_id}
                    title={ node.title }
                  ></Tree.TreeNode>
                );
              })}

            </Tree.TreeNode>
          );
        })}
      </Tree.DirectoryTree>

styles.less

.custom-tree .ant-tree-treenode:hover::before {
  background: blue !important;
}


Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading