'Folder hierarchy dotted line connector

I'm trying to create a hierarchy that looks like this:

enter image description here

The only thing I managed to come up with is :

enter image description here

I've tried editing the content to "..." yet it only works for the horizontal lines and not for the vertical lines.

How do I make the line simply dotted?

This is the css:

ul {
  display: flex;
  flex-direction: column;
  list-style: none;
}

li {
  position: relative;
  padding-top: 5px;
  padding-left: 7px;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

li::before {
  position: absolute;
  top: 15px;
  left: 0;
  width: 10px;
  height: 1px;
  margin: auto;
  content: '';
  background-color: #666;
}

li::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 100%;
  content: '';
  flex: 1;
  background-color: #666;
}

li:last-child::after {
  height: 15px;
}

.tree {
  position: relative;
  right: 60px;
  margin-right: 100px;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.5;
}

Html looks like this :

    <li>
      <div className='folder' onClick={(e) => setIsClicked((v) => !v)}>
        {hasChildren ? '📂' : '📄'}
        <div className='folder-name'>{node.name}</div>
      </div>
      {hasChildren && isClicked && (
        <ul className='tree'>
          <Tree data={node.children} />
        </ul>
      )}
    </li>

Thanks for any help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source