Skip to content

A simple tool to display a text tree with Jetpack Compose🌲

License

Notifications You must be signed in to change notification settings

takahirom/Kotree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Kotree

A simple tool to display a text tree with Jetpack Compose.

root
β”œβ”€β”€ a
β”‚   β”œβ”€β”€ c
β”‚   β”‚   └── j
β”‚   β”‚       β”œβ”€β”€ k
β”‚   β”‚       └── l
β”‚   └── f
└── d
    β”œβ”€β”€ g
    └── h
fun main() {
    println(
        kotree {
            Content()
        }
    )
}
        
@Composable
private fun Content() {
    Node("root") {
        Node("a") {
            Node("c") {
                Node("j") {
                    Node("k")
                    Node("l")
                }
            }
            Node("f")
        }
        Node("d") {
            Node("g")
            Node("h")
        }
    }
}

Not only can you draw the tree manually, but you can also visualize the structure.

sampleproject
β”œβ”€β”€ src
β”‚   └── commonMain
β”‚       └── kotlin
β”œβ”€β”€ build.gradle.kts
└── settings.gradle.kts
@Composable
private fun FileNode(file: File) {
    Node(file.name) {
        file.listFiles().forEach {
            FileNode(it)
        }
    }
}

About

A simple tool to display a text tree with Jetpack Compose🌲

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages