Bus UI Terminal

TerminalApprovalPrompt renders approval decisions.

Use it for one blocked terminal action that needs explicit approve or deny decisions with node-first prompt validation.

Public API

TerminalApprovalPrompt(prompt TerminalApprovalPrompt) gx.Node

When to use it

Use TerminalApprovalPrompt for terminal flows that require operator consent before the session can continue or exit.

Key props

ID, Title, Summary, Decisions, Pending, Disabled, Attrs, and Log.

Example

Loading TerminalApprovalPrompt demo...

Go API

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

node := terminalui.TerminalApprovalPrompt(terminalui.TerminalApprovalPromptProps{
  Title:   "Approve command?",
  Summary: "Run go test ./...?",
  Decisions: []terminalui.TerminalApprovalDecision{
    {Label: "Approve", Decision: terminalui.TerminalApprovalDecisionApprove, RequestID: "req-1", OnClick: func(terminalui.TerminalApprovalEvent) 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 TerminalApprovalPromptExample() 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

Return to Terminal or the Bus UI reference.