Bus UI Terminal

TerminalInputBox owns controlled terminal stdin.

Use it for a command row that can send text, stop execution, or stay read-only in node-first terminal surfaces.

Public API

TerminalInputBox(props TerminalInputBoxProps) gx.Node

When to use it

Use TerminalInputBox when the host owns the draft text and wants a deterministic render for submit and exit controls.

Key props

ID, SessionID, Value, OnChange, OnSend, OnExit, State, Placeholder, and Attrs.

Example

Loading TerminalInputBox demo...

Go API

import (
  gx "github.com/busdk/bus-gx/pkg/gx"
  terminalui "github.com/busdk/bus-ui/pkg/terminalui"
)

node := terminalui.TerminalInputBox(terminalui.TerminalInputBoxProps{
  SessionID: "sess_123",
  Value:     "go test ./...",
  State:     terminalui.TerminalSessionStateRunning,
  OnSend: func(terminalui.TerminalInputEvent) terminalui.Result { return terminalui.Noop() },
})

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 TerminalInputBoxExample() gx.Node {
  return <form class="terminal-input" method="post">
  <input name="command" placeholder="Run command" type="text"></input>
  <button type="submit"><Text value={"Run"}></Text></button>
</form>
}

Related

Return to Terminal or the Bus UI reference.