RaxolLiveView (Raxol LiveView v2.6.0)

Copy Markdown View Source

Phoenix LiveView integration for Raxol terminal buffers.

Renders terminal UIs in web browsers with real-time updates, keyboard/mouse event translation, and themeable CSS.

Modules

Quick start

defmodule MyAppWeb.TerminalLive do
  use MyAppWeb, :live_view
  alias Raxol.LiveView.TerminalBridge

  def mount(_params, _session, socket) do
    buffer = Raxol.Core.Buffer.create_blank_buffer(80, 24)
    {:ok, assign(socket, buffer: buffer)}
  end

  def render(assigns) do
    ~H"""
    <div class="terminal-container">
      <%= raw(TerminalBridge.buffer_to_html(@buffer, theme: :synthwave84)) %>
    </div>
    """
  end
end

CSS

Include the bundled stylesheet for base terminal styles and named color classes. Call css_path/0 to get the filesystem path.

Summary

Functions

Returns the absolute filesystem path to the bundled CSS stylesheet.

Returns the version of RaxolLiveView.

Functions

css_path()

@spec css_path() :: String.t()

Returns the absolute filesystem path to the bundled CSS stylesheet.

Copy or symlink this file into your Phoenix static assets to use the pre-built terminal styles.

Example

# In a Mix task or setup script
File.cp!(RaxolLiveView.css_path(), "priv/static/css/raxol_terminal.css")

version()

@spec version() :: String.t()

Returns the version of RaxolLiveView.