Skip to content

Conversation

@remorses
Copy link
Contributor

@remorses remorses commented Jan 4, 2026

Adds support for passing a custom CliRenderer instance to the render() function as the second parameter, while maintaining backwards compatibility with the existing config-based API.

This enables use cases like rendering OpenTUI in a web browser via WebSocket, where you need a custom renderer implementation instead of the default CLI renderer.

import { createCliRenderer } from "@opentui/core"
import { render } from "@opentui/solid"

const renderer = await createCliRenderer({ /* custom options */ })
const { dispose } = await render(() => <App />, renderer)

// Later
dispose()
  • render() now accepts either CliRendererConfig (existing) or CliRenderer instance (new)
  • render() now returns { dispose } for cleanup when using custom renderer

This PR was written by Opus 4.5 under the strict supervision of @remorses

Copilot AI review requested due to automatic review settings January 4, 2026 12:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for passing a custom CliRenderer instance to the render() function as an alternative to the existing configuration-based approach. The change enables advanced use cases like rendering OpenTUI in non-standard environments (e.g., web browsers via WebSocket) where a custom renderer implementation is required.

Key Changes:

  • The render() function now accepts either a CliRendererConfig object or a CliRenderer instance as its second parameter
  • The function now returns { dispose } to enable manual cleanup of the component tree
  • Type checking uses instanceof CliRenderer to distinguish between the two parameter types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kommander
Copy link
Collaborator

Oh I thought we did that already? Or was that just React and not solid @msmps ?

@msmps
Copy link
Collaborator

msmps commented Jan 4, 2026

Oh I thought we did that already? Or was that just React and not solid @msmps ?

it never made it into main for solid! so this needs doing 👍

@kommander kommander merged commit e8c1233 into anomalyco:main Jan 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants