The full provider chain. modes registers the mode names before any
binding can be restricted to them (defaultMode must be one of them).
With mouse enabled, SGR mouse reports are filtered out of the keyboard
stream automatically, so they never reach useInput handlers as text.
import { ScenarioManagementProvider, KeyboardProvider, CurrentScreen } from 'ink-cartridge';
function App() {
return (
<ScenarioManagementProvider defaultScreen={MainScreen} fullScreen>
<KeyboardProvider modes={['normal', 'insert']} defaultMode="normal" mouse>
<CurrentScreen />
</KeyboardProvider>
</ScenarioManagementProvider>
);
}
Provides the keyboard system to the component tree.
Instantiates a KeyboardEngine (kept alive across renders via a ref), keeps it in sync with the screen system's layer state, and feeds Ink's key events — and mouse events when
mouseis enabled — into the pipeline. Must be nested inside a ScenarioManagementProvider.