spectreconsole / spectre.console

A .NET library that makes it easier to create beautiful console applications.

Home Page:https://spectreconsole.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clickable tree nodes

iSeiryu opened this issue · comments

Is your feature request related to a problem? Please describe.
I'd like to be able to keep the tree element interactive - taking over the terminal input and let user to expand/collapse nodes while the tree is active. Some trees could be enormous, so letting a user to click on a node and load more data just for that node could be a better UX.

Describe the solution you'd like

  1. Provide a flag to allow the tree to enter the interactive mode, a.k.a. do not exist the program until a control sequence is sent, e.g. ctrl + C.
  2. Provide a click/button press event which we could subscribe to to perform an additional logic.
  3. Provide a way to re-render the tree in place.

Describe alternatives you've considered
I don't know of any alternatives.

@iSeiryu I'm sorry, but we don't want to add that kind of interactivity to Spectre.Console. If you're looking for interactive applications in the terminal, I can recommend the excellent Gui.CS project.

This library is the closest we have in dotnet to Golang's https://github.com/charmbracelet/bubbletea.
They support keyboard and mouse events.

https://github.com/gui-cs/Terminal.Gui is a completely different way of building the terminal UI which does not always fit the need of a CLI app. It'd be nice if I could only use their TreeView component within a Spectre based app but it seems like I would need to build the whole app using their library.

BubbleTea has a separate components repo https://github.com/charmbracelet/bubbles
Maybe, Spectre.Console could create a repo for some extra components which the community could contribute to? The events would probably need to belong to the core package though.