Glyph offers a powerful React renderer for developing composable terminal UIs with ease. Utilizing flexbox layout and advanced keyboard-driven navigation, it allows developers to create rich interactive applications just like web apps. With a focus on performance and usability, Glyph is designed for building efficient terminal applications.
Glyph is a powerful React-based framework designed for building modern, composable terminal User Interfaces (TUIs). Leveraging a full component model with CSS-like flexbox layout powered by Yoga, Glyph allows developers to create terminal applications as intuitively as they would for the web. Its features include efficient keyboard input management, focus management, and smart rendering that ensures only changes to character cells are written, enhancing performance.
useInput hook and declarative <Keybind> component for comprehensive keyboard shortcut management, including vim-style key bindings.To create a simple Glyph application:
import React from "react";
import { render, Box, Text, Keybind, useApp } from "@nick-skriabin/glyph";
function App() {
const { exit } = useApp();
return (
<Box style={{ border: "round", borderColor: "cyan", padding: 1 }}>
<Text style={{ bold: true, color: "green" }}>Hello, Glyph!</Text>
<Keybind keypress="q" onPress={() => exit()} />
</Box>
);
}
render(<App />);
Invoke the app with the command:
npx tsx app.tsx
Glyph provides a broad array of components for various use cases:
Glyph also includes hooks such as useInput, useFocus, and useApp that provide vital utilities for keyboard handling, element focus tracking, and core app functionality.
Glyph is a versatile choice for developers seeking to build complex terminal applications with the simplicity and intuitiveness of React. With its rich feature set and support for modern web development practices, Glyph allows for high-quality terminal UI development.
No comments yet.
Sign in to be the first to comment.