Skip to content
Kite

Quick Start

Welcome to the Kite documentation! This page introduces the core concepts you will use in almost every terminal application.

You will learn
  • How to create and nest Kitex components
  • How to style elements with style.S() and pseudo-states
  • How to respond to keyboard and mouse events and update state
  • How to render keyed lists and conditional UI
  • When to add shared state (kites), async data (wind), or screens (flight)

Kite applications are built from components—reusable pieces of terminal UI that manage their own appearance and logic. With extras/kitex, define a component using kitex.FC (leaf component) or kitex.FCC (container accepting children).

PackageCardHeaderBadgeStarButtonInstallButtonUseState(false)UseState(false)
Each component owns its own local state and composes into larger terminal views.

Call kitex.UseState inside a component to remember state across renders. Combine it with style.S() pseudo-states (.Hover(...), .Focus(...), .Active(...)) and OnPress to respond to both mouse clicks and keyboard Enter/Space activation:

package_cardWASM
var StarButton = kitex.FC("StarButton", func(_ kitex.NoProps) kitex.Node {
starred, setStarred := kitex.UseState(false)
count := 128
btnStyle := buttonStyle
if starred() {
count = 129
btnStyle = starredButtonStyle
}
return kitex.Button(kitex.ButtonProps{
Style: btnStyle,
OnPress: func() { setStarred(!starred()) },
}, kitex.Textf("★ %d", count))
})
Starting terminal…
Click ★ 128 or Install. Esc to leave

Every dimension in Kite is measured in terminal cells (or percentages and fr grid tracks). Build sparse styles fluently with style.S(), chaining one property per line for clarity:

cardStyle := style.S().
Width(style.Percent(100)).
Padding(1, 2).
Border(style.SingleBorder().Color(style.Hex("#334866"))).
Background(style.Hex("#111a2e")).
Hover(style.S().
Border(style.SingleBorder().Color(style.Hex("#38bdf8"))),
)

Because Kite resolves :hover, :focus, :active, and :disabled inside the style engine, hover highlights do not require re-rendering your component.

Use standard Go if statements for conditional rendering and kitex.Map (with a stable Key prop) when mapping slices into nodes so the reconciler preserves element focus and component state as items reorder or filter:

rows := kitex.Map(tasks, func(item Task) kitex.Node {
return kitex.Box(kitex.BoxProps{
Key: item.ID,
Style: rowStyle,
}, kitex.Text(item.Title))
})

As your TUI grows, Kite’s optional extras/* packages plug into the exact same engine without changing your component model:

extras/kitesShared app stateextras/windQueries & streamsextras/kitexComponents · Hooks · Flightkite.EngineDOM · Layout · Paint · Backend
State stores, async caches, and routers feed Kitex components, which reconcile into Kite’s DOM and render to any backend (UV terminal, WASM canvas, or headless mock).