ElementTui: an Elixir library to create terminal user interfaces (tui).
Find a file
Edwin van Leeuwen 290e10cb43
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
focus+bug: Fix bug in focussing of larger items
2024-09-25 09:13:51 +01:00
config ci: Don't start the application (genserver) when running tests 2024-08-20 15:40:33 +00:00
lib focus+bug: Fix bug in focussing of larger items 2024-09-25 09:13:51 +01:00
src input: Support adding a cursor to text 2024-06-05 06:23:17 +00:00
test feat: Cleanup component interface by specifying return type 2024-09-23 08:36:32 +01:00
.formatter.exs tui: Move the library to a separate repository and commit 2024-04-11 16:43:54 +00:00
.gitignore git: Remove mix.lock from git 2024-05-19 08:13:56 +01:00
.woodpecker.yaml ci: Add event filter for test pipeline 2024-06-16 09:05:27 +01:00
LICENSE Add LICENSE 2024-04-11 16:46:36 +00:00
Makefile release: Version bump 2024-05-19 07:57:29 +01:00
mix.exs release: Update to version 0.5.0 2024-09-01 10:02:22 +01:00
README.md release: Update to version 0.5.0 2024-09-01 10:02:22 +01:00

ElementTui

An Elixir library to create terminal user interfaces (tui), using termbox2 under the hood. Elementtui provides the basic building blocks for a TUI. There is a companion library available with more complicated components. Code examples are available in a separate repository.

Installation

The package can be installed by adding elementtui to your list of dependencies in mix.exs:

def deps do
  [
    {:elementtui, "~> 0.5"}
  ]
end

Usage

There are some simple examples available on codeberg that should help you get started. Also see the documentation on hexdocs.

Minimal hello world example:

ElementTui.run_loop(
  fn _, ev -> case ev do
      {:key,  _, _, ?q} ->
        {:halt, nil}

      _ ->
        ElementTui.Element.text("Hello World")
        |> ElementTui.render(5, 5, 100, 1)

        ElementTui.present()

        {:cont, nil}
    end
  end,
  nil,
  timeout: 1000
)

Note that when starting your own project you need to make sure elixir/erlang does not listen for input, by setting -noinput in the mix.exs file.

Examples

For the code to create these examples see codeberg/elementtui_examples

Performance example

performance

Popup example

popup

Component example

Example of the tab and xygraph components. See the examples repository for the code.

component

Rtttex

rtttex is a full fledged tui build using the elementtui library.