← Back to Skills Marketplace
openlark

OpenTUI — Native Terminal UI Framework

by OpenLark · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
15
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install opentui
Description
OpenTUI — Zig-native terminal UI framework. Covers installation, renderer, components (Text/Box/Input/Select/Code/ScrollBox), Constructs declarative API, Fle...
README (SKILL.md)

OpenTUI — Native Terminal UI Framework

Zig-native TUI core with TypeScript bindings and Yoga Flexbox layout. Powers OpenCode in production.

Use Cases

Use when building terminal TUI applications.

Installation

bun init -y && bun add @opentui/core
# React: bun add @opentui/react @opentui/core react; bun create tui --template react
# Solid: bun add solid-js @opentui/solid

Renderer

const r = await createCliRenderer({
  screenMode: "alternate-screen"|"main-screen"|"split-footer",
  targetFps: 30, exitOnCtrlC: true, useMouse: true, autoFocus: true,
  backgroundColor: "transparent", consoleMode: "console-overlay"|"disabled",
})
r.root.add(Text({ content:"Hello", fg:"#0F0" }))
r.start()/stop()/pause()/suspend()/resume()/destroy()
r.on("resize",(w,h)=>{}); r.on("focus"|"blur"|"destroy",()=>{})
r.on("theme_mode",m=>{}); r.on("selection",s=>s.getSelectedText())
r.setTerminalTitle("t"); r.setBackgroundColor("#0D1117")

// Scrollback (split-footer mode)
r.writeToScrollback(ctx=>({root,width:ctx.width,height:1,startOnNewLine:true}))
const sf = r.createScrollbackSurface({}); sf.root.add(code); sf.settle(); sf.destroy()

Components

// Text
Text({content:"hello",fg:"#F00",bg:"#222",attributes:BOLD|UNDERLINE,selectable:true,position:"absolute",left:10,top:5})
// Attributes: BOLD DIM ITALIC UNDERLINE BLINK INVERSE HIDDEN STRIKETHROUGH
// Inline template: t`${bold("t")}: ${fg("#F00")(italic("w"))} normal`

// Box
Box({width:30,height:10,borderStyle:"rounded"|"single"|"double"|"heavy",borderColor:"#FFF",
     title:"Settings",titleAlignment:"left"|"center"|"right",padding:1,gap:1,
     onMouseDown:()=>{},onMouseOver:()=>{},onMouseOut:()=>{}})

// Input
Input({width:25,placeholder:"Type...",backgroundColor:"#222",focusedBackgroundColor:"#333",
       textColor:"#FFF",cursorColor:"#0F0"})
input.focus(); input.value="new"; // Events: INPUT / CHANGE / ENTER

// Select
Select({width:30,height:8,options:[{name:"Option",description:"desc",value:any}],
        selectedIndex:0,backgroundColor:"#1a1a1a",selectedBackgroundColor:"#333366"})
// Arrow keys/jk navigate, Enter to select; Events: ITEM_SELECTED / SELECTION_CHANGED

// Code (Tree-sitter)
const style = SyntaxStyle.fromStyles({keyword:{fg:RGBA.fromHex("#FF7B72"),bold:true},default:{fg:RGBA.fromHex("#E6EDF3")}})
Code({content:"const x=1",filetype:"typescript",syntaxStyle:style,streaming:false,width:50,height:10})
// Markdown: MarkdownRenderable({content:"# H1",syntaxStyle,streaming:true,conceal:true})
// Diff: DiffRenderable({view:"unified"|"split",syncScroll:true,diff:"patch",syntaxStyle})

// ScrollBox
ScrollBox({width:40,height:20,scrollY:true,stickyScroll:true,stickyStart:"bottom"|"top",
           viewportCulling:true,scrollbarOptions:{showArrows:true,trackOptions:{foregroundColor:"#7aa2f7"}}})
// Keyboard: ↑↓/pgup/pgdn/home/end; Methods: scrollBy(y)/scrollTo({x,y})/scrollChildIntoView("id")

Others: TextArea TabSelect ASCIIFont({text:"T",font:"tiny"}) LineNumberRenderable({target:code})

Constructs (Declarative API)

Box({width:40,borderStyle:"rounded",padding:1}, Text({content:"Hi"}), Input({placeholder:"..."}))
// VNodes queue method calls: input.focus() → auto-executed when added to tree

function LabeledInput({id,label,pl}) {
  return delegate({focus:`${id}-in`},
    Box({flexDirection:"row"}, Text({content:label}),
    Input({id:`${id}-in`,placeholder:pl,width:20})))
}
// delegate({focus:"child-id"}, vnode) routes methods to child components

function Card({title},...children) {
  return Box({border:true,padding:1,flexDirection:"column"},
    Text({content:title,fg:"#FF0"}), Box({flexDirection:"column"},...children))
}

Flexbox Layout (Yoga)

Box({flexDirection:"row"|"column"|"row-reverse"|"column-reverse",
     justifyContent:"center"|"space-between"|"space-around"|"space-evenly",
     alignItems:"center"|"stretch"|"baseline",
     flexGrow:1,flexShrink:0,flexBasis:100,
     width:"100%"|30,height:"50%"|10,
     position:"absolute",left:10,top:5,right:10,bottom:5,
     padding:2,paddingX:4,paddingTop:1,margin:1,gap:1})
// Responsive resize: r.on("resize",(w,h)=>{w\x3C80&&(container.flexDirection="column")})

React Bindings

// tsconfig: "jsx":"react-jsx","jsxImportSource":"@opentui/react"
import {createRoot} from "@opentui/react"
createRoot(await createCliRenderer()).render(\x3CApp />)
// JSX: \x3Ctext> \x3Cbox> \x3Cscrollbox> \x3Cinput> \x3Ctextarea> \x3Cselect> \x3Ccode> \x3Cdiff> \x3Cmarkdown>
// Style modifiers: \x3Cbold> \x3Citalic> \x3Cunderline> \x3Cinline> \x3Cbr/> \x3Clink>
// Hooks: useRenderer() useKeyboard((k)=>{}) useOnResize((w,h)=>{})
//        useTerminalDimensions() usePaste((e)=>{}) useFocus/useBlur(()=>{})
//        useSelectionHandler((sel)=>{}) useTimeline({duration,loop})

Solid Bindings

// tsconfig: "jsx":"preserve","jsxImportSource":"@opentui/solid"
// bunfig.toml: preload=["@opentui/solid/preload"]
import {render} from "@opentui/solid"
render(()=>\x3CApp />) // snake_case component names: ascii_font tab_select
// Hooks same as React + Portal(\x3CPortal mount={r.root}>), Dynamic(\x3CDynamic component="textarea"/>)
// Build: import solidPlugin from "@opentui/solid/bun-plugin"; Bun.build({plugins:[solidPlugin]})
Usage Guidance
Install only if you intend to build OpenTUI-based terminal apps. Review the Bun packages before adding them to a project, but the submitted skill itself is a concise reference guide with no suspicious runtime behavior.
Capability Assessment
Purpose & Capability
The stated purpose is to help build terminal UI applications with OpenTUI, and the artifact content is limited to installation notes and API examples for renderer setup, components, layout, and framework bindings.
Instruction Scope
Instructions are scoped to user-directed development tasks; examples cover normal TUI capabilities such as alternate screen mode, mouse input, focus handling, scrollback, and terminal title changes.
Install Mechanism
The skill suggests user-run Bun package installation commands for @opentui packages and React or Solid bindings, which is expected for a framework guide and not automatic or hidden.
Credentials
Terminal control and package installation are proportionate to building terminal UI applications, with no evidence of credential access, broad filesystem indexing, background workers, or unrelated network behavior.
Persistence & Privilege
No persistence mechanism, privilege escalation, startup hooks, credential/session use, or long-running background behavior is present in the artifact.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install opentui
  3. After installation, invoke the skill by name or use /opentui
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
OpenTUI 1.0.0 — Initial Release - Introduces a Zig-native terminal UI framework with TypeScript, React, and Solid bindings. - Provides core components: Text, Box, Input, Select, Code (Tree-sitter), and ScrollBox. - Supports a declarative API with flexible Flexbox layout (powered by Yoga). - Includes event handling, theme, terminal control, and advanced rendering modes. - Production-ready, powering OpenCode; features responsive layouts and modern developer workflows.
Metadata
Slug opentui
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is OpenTUI — Native Terminal UI Framework?

OpenTUI — Zig-native terminal UI framework. Covers installation, renderer, components (Text/Box/Input/Select/Code/ScrollBox), Constructs declarative API, Fle... It is an AI Agent Skill for Claude Code / OpenClaw, with 15 downloads so far.

How do I install OpenTUI — Native Terminal UI Framework?

Run "/install opentui" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is OpenTUI — Native Terminal UI Framework free?

Yes, OpenTUI — Native Terminal UI Framework is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does OpenTUI — Native Terminal UI Framework support?

OpenTUI — Native Terminal UI Framework is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created OpenTUI — Native Terminal UI Framework?

It is built and maintained by OpenLark (@openlark); the current version is v1.0.0.

💬 Comments