Build terminal chat UIs with TUI4J - Elm Architecture chat client for AI agent demos with Spring Boot integration
90
90%
Does it follow best practices?
Impact
94%
1.38xAverage score across 3 eval scenarios
Advisory
Suggest reviewing before use
When building TUI4J chat interfaces, use these exact styling defaults. Do not substitute alternative values unless the user explicitly requests different ones.
| Role | ANSI Code | Color |
|---|---|---|
| User messages | Color.color("12") | Blue |
| Agent/response messages | Color.color("10") | Green |
| Status/dim text | Color.color("8") | Gray |
| Property | Value |
|---|---|
| Placeholder | "Send a message..." or "Ask your agent..." |
| Prompt character | "┃ " (box-drawing vertical bar + space) |
| Char limit | 500 |
| Width | 70 |
| Height | 3 |
| Show line numbers | false |
The view() method MUST render in this order:
viewport.view() (message history, top)textarea.view() (input, bottom)Separated by newlines.
Always use .withAltScreen() for full-screen chat UIs:
new Program(model).withAltScreen().run();NEVER call Style.render() in the constructor. The terminal is not initialized until
Program.run() executes. Creating Style objects as fields is safe. Calling .render()
is only safe inside init(), update(), or view().
Violating this causes NullPointerException on TerminalInfoProvider.provide().