Overview
The renderer module provides the core rendering engine for Bunli TUI applications. It manages the OpenTUI renderer lifecycle, handles alternate screen buffers, and provides React integration.Imports
runTuiRender
Runs a TUI render with the provided command and options.Parameters
Render configuration
Example
TuiRenderOptions
Configuration options for the OpenTUI renderer.Fields
Whether to exit the application on Ctrl+C
Target frames per second for rendering
Enable mouse movement events
Enable mouse input support
Terminal buffer mode:
alternate: Full-screen alternate buffer (clears screen)standard: Render in the main buffer (inline with terminal history)
Example
Runtime Events
The renderer emits lifecycle events through the transport:Emitted when the renderer starts
Emitted when the renderer is destroyed
Emitted when command.render is missing or invalid
AppRuntimeProvider
React context provider for runtime features.AppRuntimeProvider is automatically included by runTuiRender, so you typically don’t need to use it directly.
Best Practices
Buffer Mode Selection
- Use
alternatefor full-screen applications (dashboards, editors) - Use
standardfor inline output that should remain in terminal history
Frame Rate
- Default 30 FPS is suitable for most applications
- Increase to 60 FPS for smooth animations
- Lower FPS reduces CPU usage for static content
Error Handling
- Always provide a valid
renderfunction - Handle component errors with React error boundaries
- Use transport to monitor renderer lifecycle events