TermUI User Guides
View SourceWelcome to the TermUI documentation. These guides cover everything you need to build terminal user interfaces with Elixir.
Guides
- Overview - Introduction to TermUI and its architecture
- Getting Started - Build your first TermUI application
- The Elm Architecture - Understanding the component model
- Events - Handling keyboard, mouse, and other input
- Styling - Colors, attributes, and themes
- Layout - Positioning and sizing components
- Widgets - Using pre-built components
- Terminal - Terminal modes and capabilities
- Commands - Side effects and async operations
- Advanced Widgets - Navigation, visualization, data streaming, and BEAM introspection widgets
Quick Start
defmodule MyApp do
use TermUI.Elm
def init(_opts), do: %{count: 0}
def event_to_msg(%Event.Key{key: :up}, _), do: {:msg, :inc}
def event_to_msg(%Event.Key{key: :down}, _), do: {:msg, :dec}
def event_to_msg(%Event.Key{key: "q"}, _), do: {:msg, :quit}
def event_to_msg(_, _), do: :ignore
def update(:inc, s), do: {%{s | count: s.count + 1}, []}
def update(:dec, s), do: {%{s | count: s.count - 1}, []}
def update(:quit, s), do: {s, [:quit]}
def view(state), do: text("Count: #{state.count}")
end
# Run with: TermUI.Runtime.run(root: MyApp)Requirements
- Elixir 1.15+
- OTP 28+
- Terminal with ANSI support
Examples
See the examples/ directory for complete applications:
- dashboard - System monitoring dashboard with gauges, sparklines, and tables