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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
element | ReactElement | Root React element to render. |
opts | RenderOptions | Optional configuration (custom streams, debug mode, cursor). |
Returns
Section titled “Returns”An AppHandle with unmount() and exit() methods.
Example
Section titled “Example”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 />);RenderOptions
Section titled “RenderOptions”Options for the top-level render function.
Properties
Section titled “Properties”AppHandle
Section titled “AppHandle”Handle returned by render, used to control the application lifecycle.
Methods
Section titled “Methods”exit()
Section titled “exit()”exit(code?): void;Exit the process with an optional exit code.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
code? | number |
Returns
Section titled “Returns”void
unmount()
Section titled “unmount()”unmount(): void;Tear down the React tree and clean up terminal state.
Returns
Section titled “Returns”void