The dashboard as a Phoenix LiveView — the browser transport.
Available when the optional phoenix_ex_ratatui
dependency is present; without it this module is not compiled. Add it
next to bb_tui:
{:bb_tui, "~> 0.7"},
{:phoenix_ex_ratatui, "~> 0.3"}Define a LiveView and route to it like any other:
defmodule MyAppWeb.RobotLive do
use BB.TUI.Live, robot: MyApp.Robot
end
# router.ex
live "/robot", MyAppWeb.RobotLiveThe use options are the dashboard's mount options — the same keyword
list BB.TUI.start/2 takes (:robot is required; :node,
:subscribe_paths, and :renderers pass through). For per-session
options — picking the robot from the session or params — override
tui_mount_opts/1, which receives the LiveView socket after mount:
defmodule MyAppWeb.RobotLive do
use BB.TUI.Live, robot: MyApp.Robot
def tui_mount_opts(socket) do
[robot: socket.assigns.robot]
end
endEach browser connection runs its own isolated dashboard session over
the shared robot, exactly as concurrent SSH clients do. The JS side
needs phoenix_ex_ratatui's hook registered once in app.js — see
the phoenix_ex_ratatui docs
and the dev/web demo endpoint in this repository for the wiring.
The Visualization tab renders the robot as a real bitmap in the browser:
the hook reports the measured cell size with its resize event, the
transport opens the CellSession with that font size, and Viewport3D
in :auto (the default) or any explicit pixel mode ships as a pixel
region painted over the grid. The cell-blit modes (:half_block,
:braille, :ascii) still render as cells. A JS bundle built against
phoenix_ex_ratatui 0.2 reports no cell size, and the tab silently falls
back to :braille — rebuild the assets after updating the dependency.