Bus UI Terminal
Terminal surfaces are split into focused component pages.
Use these pages for the session panel, output stream, input box, approval prompt,
and the adapter/session-view layer that projects terminal events into renderable
state. Preferred public package:
github.com/busdk/bus-ui/pkg/terminalui. Use the public package shown here for current product code.
Public APIs
| Page | Use it for | Public API |
|---|---|---|
| TerminalSessionPanel | Terminal session chrome, command context, output, and session status. | TerminalSessionPanel(props TerminalSessionPanelProps) gx.Node |
| TerminalOutputView | Validated stdout, stderr, stdin, and system output chunks. | TerminalOutputView(chunks []TerminalChunk, emptyText string, log ControlLogSink) gx.Node |
| TerminalInputBox | Command entry, submit state, and exit actions. | TerminalInputBox(props TerminalInputBoxProps) gx.Node |
| TerminalApprovalPrompt | Pending approval prompts and decision buttons. | TerminalApprovalPrompt(prompt TerminalApprovalPrompt) gx.Node |
| TerminalAdapters | Terminal event normalization, session views, and adapter helpers. | TerminalSessionAdapter(input TerminalSessionAdapterInput) (TerminalSessionView, Dispose, error) |
Example
Go API
import (
gx "github.com/busdk/bus-gx/pkg/gx"
terminalui "github.com/busdk/bus-ui/pkg/terminalui"
)
seq := 1
node := terminalui.TerminalSessionPanel(terminalui.TerminalSessionPanelProps{
Title: "Verification",
Command: "go test ./...",
SessionID: "sess_123",
State: terminalui.TerminalSessionStateRunning,
Output: []terminalui.TerminalChunk{{Stream: "stdout", Sequence: &seq, Text: "ok"}},
EmptyOutput: "No output yet.",
})
html, err := gx.RenderHTML(node)
.gx source
In .gx source, author the visible component state as GX markup.
Keep the Go API block above for the package helper or render-boundary call.
package busuiexamples
import gx "github.com/busdk/bus-gx/pkg/gx"
func TerminalSessionPanelExample() gx.Node {
return <section class="terminal-session">
<header><h2><Text value={"Verification"}></Text></h2><p><Text value={"go test ./..."}></Text></p></header>
<pre aria-label="Terminal output"><Text value={"No output yet."}></Text></pre>
<form method="post"><input name="command" type="text"></input><button type="submit"><Text value={"Run"}></Text></button></form>
</section>
}
Related
See the Bus UI library index or the Bus UI reference.