Skip to content

render

function render(element, opts?): AppHandle;

Mount a React element into the terminal and start the render loop.

This is the entry point for every Glyph application. It sets up the terminal (raw mode, alternate screen), creates the React reconciler, and begins painting frames.

ParameterTypeDescription
elementReactElementRoot React element to render.
optsRenderOptionsOptional configuration (custom streams, debug mode, cursor).

AppHandle

An AppHandle with unmount() and exit() methods.

import { render, Box, Text } from "@semos-labs/glyph";
function App() {
return (
<Box style={{ padding: 1 }}>
<Text style={{ bold: true, color: "cyan" }}>Hello Glyph!</Text>
</Box>
);
}
render(<App />);

Options for the top-level render function.

PropertyTypeDescription
debug?boolean-
stdin?ReadStream-
stdout?WriteStream-
useNativeCursor?booleanUse the terminal’s native cursor instead of a simulated one. Enables cursor shaders/animations in supported terminals. Default: true

Handle returned by render, used to control the application lifecycle.

exit(code?): void;

Exit the process with an optional exit code.

ParameterType
code?number

void


unmount(): void;

Tear down the React tree and clean up terminal state.

void