InkUI
Components

Tabs

Keyboard-navigable tab panels with underline, boxed, and pills variants.

Switch between content views using keyboard navigation. Supports disabled tabs, badge counts, and three visual styles.

Live Preview
Tabs · underline variant
FilesLogsMetricsConfig
src/
index.ts
utils.ts
~/my-cli — node v22● running

Installation

npx inkui add tabs

Usage

import { Tabs } from './components/ui/tabs';
import { useState } from 'react';
import { Text } from 'ink';
 
const tabs = [
  { key: 'logs', label: 'Logs' },
  { key: 'metrics', label: 'Metrics' },
  { key: 'config', label: 'Config' },
];
 
export default function App() {
  const [active, setActive] = useState('logs');
  return (
    <Tabs tabs={tabs} activeKey={active} onChange={setActive}>
      <Text>Log output here</Text>
      <Text>Metrics dashboard</Text>
      <Text>Configuration panel</Text>
    </Tabs>
  );
}

Keyboard Shortcuts

KeyAction
/ hPrevious tab
/ lNext tab
1–9Jump to tab by index

API Reference

PropTypeDefaultDescription
tabsTab[]Tab definitions (required)
activeKeystringCurrently active tab key
onChange(key: string) => voidCalled on tab change (required)
position'top' | 'bottom''top'Tab bar position
variant'underline' | 'boxed' | 'pills''underline'Visual style
focusbooleantrueAccept keyboard input
themeInkUIThemedarkThemeColor theme

Tab Object

FieldTypeDescription
keystringUnique identifier
labelstringDisplay label
badgenumberOptional badge count
disabledbooleanDisable this tab

On this page