Skip to content

Status Bar

A fixed-position status bar component for Ink 5. Renders a single-row bar at the bottom of your terminal UI with key hints, mode indicators, and context info — the kind you see in vim, htop, or nano.

Install

Terminal window
npm install @matthesketh/ink-status-bar

Usage

import React from 'react';
import { render, Text } from 'ink';
import { StatusBar } from '@matthesketh/ink-status-bar';
function App() {
return (
<>
{/* your app content */}
<StatusBar
items={[
{ key: 'q', label: 'quit' },
{ key: 'Tab', label: 'switch view' },
{ key: '?', label: 'help' },
]}
/>
</>
);
}
render(<App />);

With slots

<StatusBar
left={<Text bold>INSERT</Text>}
center={<Text>index.ts</Text>}
right={<Text>3/10</Text>}
backgroundColor="blue"
color="white"
/>

Key hints with a mode indicator

<StatusBar
left={<Text bold>NORMAL</Text>}
items={[
{ key: 'i', label: 'insert' },
{ key: ':', label: 'command' },
]}
right={<Text>Ln 42, Col 8</Text>}
/>

Props

PropTypeDefaultDescription
itemsKeyHint[]undefinedKey hints displayed as [key] label pairs. Placed in left slot if no left prop, otherwise in center.
leftReact.ReactNodeundefinedContent aligned to the left (e.g. mode indicator).
centerReact.ReactNodeundefinedContent aligned to the center (e.g. filename).
rightReact.ReactNodeundefinedContent aligned to the right (e.g. position info).
backgroundColorstring'gray'Background colour for the entire bar.
colorstring'white'Default text colour.

KeyHint

interface KeyHint {
key: string; // e.g. "q", "Tab", "↑↓"
label: string; // e.g. "quit", "switch view"
}

Requirements

  • Node.js >= 18
  • React >= 18.0.0
  • Ink >= 5.0.0