gridland
Components

StatusBar

A horizontal bar displaying keybinding hints

A horizontal bar that displays keybinding hints with key labels and descriptions. Commonly placed at the bottom of a view.

StatusBar
?

Run demo

Terminal
bunx @gridland/demo status-bar
Terminal
curl -fsSL https://raw.githubusercontent.com/thoughtfulllc/gridland/main/scripts/run-demo.sh | bash -s status-bar

Installation

Terminal
bunx create-gridland add status-bar

Usage

import { StatusBar } from "@/components/ui/status-bar"
<StatusBar
  items={[
    { key: "Tab", label: "switch focus" },
    { key: "q", label: "quit" },
  ]}
/>

Examples

Multiple Items

Multiple keybindings
<StatusBar
  items={[
    { key: "↑↓", label: "navigate" },
    { key: "Enter", label: "select" },
    { key: "Esc", label: "cancel" },
    { key: "q", label: "quit" },
  ]}
/>

With Extra Content

Render custom inline content to the left of the hints. A dim separator appears between the extra content and the keybinding items.

With extra
import { StatusBar } from "@/components/ui/status-bar"
import { textStyle } from "@/lib/text-style"
import { useTheme } from "@/lib/theme"

const theme = useTheme()

<StatusBar
  items={[{ key: "←→", label: "change type" }]}
  extra={<span style={textStyle({ fg: theme.accent, bold: true })}>dots</span>}
/>

Dynamic Items

Build items based on component state.

Dynamic items
const items: StatusBarItem[] = [
  { key: "↑↓", label: "navigate" },
  { key: "Enter", label: "select" },
]

if (isEditing) {
  items.push({ key: "Esc", label: "cancel" })
}

<StatusBar items={items} />

With Theme Colors

Style the extra content using theme tokens.

Themed extra
import { StatusBar } from "@/components/ui/status-bar"
import { textStyle } from "@/lib/text-style"
import { useTheme } from "@/lib/theme"

function MyStatusBar({ model }: { model: string }) {
  const theme = useTheme()

  return (
    <StatusBar
      items={[{ key: "Tab", label: "switch focus" }]}
      extra={
        <span style={textStyle({ fg: theme.secondary, dim: true })}>
          {model}
        </span>
      }
    />
  )
}

API Reference

StatusBar

PropTypeDefaultDescription
itemsStatusBarItem[]-Array of keybinding hints to display
extraReactNode-Inline content rendered left of the hints (must be <span> or string)

StatusBarItem

FieldTypeDescription
keystringKey or key combination text (e.g. "Tab", "←→")
labelstringDescription of what the key does