Getting Started
A framework for building interactive terminal user interfaces with React and Ink
giggles is a framework for building interactive terminal user interfaces (TUIs) with React and Ink. It provides a declarative, composable system for handling focus navigation and keyboard input in terminal applications.
Installation
Install giggles along with its peer dependencies:
npm install giggles ink reactpnpm add giggles ink reactyarn add giggles ink reactVerify requirements:
- Node.js 16+
- React 18+ or 19+
- Ink 6+
Your First TUI
Here's a simple menu with keyboard navigation:
import { Box, Text, render, useApp } from 'ink';
import { GigglesProvider, FocusGroup, useFocus, useKeybindings } from 'giggles';
function App() {
const { exit } = useApp();
const focus = useFocus();
useKeybindings(focus, {
q: () => exit(),
});
return (
<Box flexDirection="column">
<Text bold>My Menu (j/k to navigate, q to quit)</Text>
<FocusGroup direction="vertical">
<Text>Start Game</Text>
<Text>Settings</Text>
<Text>Exit</Text>
</FocusGroup>
</Box>
);
}
render(
<GigglesProvider>
<App />
</GigglesProvider>
);What's happening
GigglesProviderwraps your app and provides focus + input contextFocusGroupcreates a navigable group (usej/kor arrow keys)useFocus()gives your component access to focus stateuseKeybindings()binds keys to actions when focused
Next Steps
- Core Concepts → - Understand focus and input systems
- API Reference → - Framework API documentation