ORIZEN/TUI
ComponentsCounter

Counter

stable

Display component for numeric values. User provides the increment logic.

Browser preview is a simulation. The copied component runs in actual terminal apps.

counter.tsx
0 tests passed

Installation

npx orizen-tui@latest add counter

if dependency install fails, run: npm install ink@^5.0.1 react@^18.3.1 @types/react@^18.3.18 orizen-tui-core@latest

Usage

counter.imports.tsx
counter.example.tsx

Examples

Basic Usage

counter.example1.tsx
0 tests passed

Custom Label

counter.example2.tsx
0 tests passed

Custom Color

counter.example3.tsx
0 seconds

API Reference

Counter

value-
number

Current value (controlled mode)

onChange-
(value: number) => void

Callback fired when value changes

defaultValue0
number

Initial value for uncontrolled mode

label"count"
string

Label shown after the counter value

color"green"
string

Text color

focusfalse
boolean

Focus state (makes text bold)