You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@opentui/solid

Package Overview
Dependencies
Maintainers
3
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentui/solid

SolidJS renderer for OpenTUI

Source
npmnpm
Version
0.1.90
Version published
Weekly downloads
21K
-43.08%
Maintainers
3
Weekly downloads
 
Created
Source

@opentui/solid

Solid.js support for OpenTUI.

Installation

bun install solid-js @opentui/solid

Usage

  • Add jsx config to tsconfig.json:
{
  "compilerOptions": {
    "jsx": "preserve",
    "jsxImportSource": "@opentui/solid"
  }
}
  • Add preload script to bunfig.toml:
preload = ["@opentui/solid/preload"]
  • Add render function to index.tsx:
import { render } from "@opentui/solid"

render(() => <text>Hello, World!</text>)
import solidPlugin from "@opentui/solid/bun-plugin"

await Bun.build({
  entrypoints: ["./index.tsx"],
  target: "bun",
  outdir: "./build",
  plugins: [solidPlugin],
  compile: {
    target: "bun-darwin-arm64",
    outfile: "app-macos",
  },
})

Table of Contents

Core Concepts

Components

OpenTUI Solid exposes intrinsic JSX elements that map to OpenTUI renderables:

  • Layout & Display: text, box, scrollbox, ascii_font
  • Input: input, textarea, select, tab_select
  • Code & Diff: code, line_number, diff
  • Text Modifiers: span, strong, b, em, i, u, br, a

API Reference

render(node, rendererOrConfig?)

Render a Solid component tree into a CLI renderer. If rendererOrConfig is omitted, a renderer is created with default options.

import { render } from "@opentui/solid"

render(() => <App />)

Parameters:

  • node: Function returning a JSX element.
  • rendererOrConfig?: CliRenderer instance or CliRendererConfig.

testRender(node, options?)

Create a test renderer for snapshots and interaction tests.

import { testRender } from "@opentui/solid"

const testSetup = await testRender(() => <App />, { width: 40, height: 10 })

extend(components)

Register custom renderables as JSX intrinsic elements.

import { extend } from "@opentui/solid"

extend({ customBox: CustomBoxRenderable })

getComponentCatalogue()

Returns the current component catalogue that powers JSX tag lookup.

Hooks

  • useRenderer()
  • onResize(callback)
  • onFocus(callback)
  • onBlur(callback)
  • useTerminalDimensions()
  • useKeyboard(handler, options?)
  • usePaste(handler)
  • useSelectionHandler(handler)
  • useTimeline(options?)

Portal

Render children into a different mount node, useful for overlays and tooltips.

import { Portal } from "@opentui/solid"
;<Portal mount={renderer.root}>
  <box border>Overlay</box>
</Portal>

Dynamic

Render arbitrary intrinsic elements or components dynamically.

import { Dynamic } from "@opentui/solid"
;<Dynamic component={isMultiline() ? "textarea" : "input"} />

Components

Layout & Display

  • text: styled text container
  • box: layout container with borders, padding, and flex settings
  • scrollbox: scrollable container
  • ascii_font: ASCII art text renderer

Input

  • input: single-line text input
  • textarea: multi-line text input
  • select: list selection
  • tab_select: tab-based selection

Code & Diff

  • code: syntax-highlighted code blocks
  • line_number: line-numbered code display with diff/diagnostic helpers
  • diff: unified or split diff viewer

Text Modifiers

These must appear inside a text component:

  • span: inline styled text
  • strong/b: bold text
  • em/i: italic text
  • u: underline text
  • br: line break
  • a: link text with href

FAQs

Package last updated on 21 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts