Enhanced terminal UI toolkit for Node.js with TypeScript support. Create beautiful, interactive command-line interfaces with spinners, progress bars, custom colors, and advanced styling.
- 🎯 Spinners - Beautiful terminal loading animations with 6 predefined styles
- 📊 Progress Bars - Visual progress tracking with multiple styles and real-time updates
- 🎨 Advanced Colors - 25 predefined colors + RGB + Hex + Background support
- 🎭 Text Styling - Bold, italic, underline with full ANSI support
- ⚡ Performance - Efficient rendering with minimal overhead
- 🌈 Custom Colors - Support for RGB values, hex codes, and background colors
- 🔒 Type Safe - Full TypeScript support with strict typing
- 🚀 Modern - ES modules and Node.js 22+ support
npm install @neabyte/console-kitimport{ConsoleKit}from'@neabyte/console-kit'// Create a spinnerconstspinner=ConsoleKit.spinner('Processing files...')awaitspinner.start()// Do some work...awaitprocessFiles()// Stop with success messageawaitspinner.succeed('Files processed successfully!')// Create a progress barconstprogress=ConsoleKit.progress('Uploading files...',{total: 100})awaitprogress.start()// Update progressprogress.update(50)progress.increment(25)// Complete with successawaitprogress.succeed('Upload complete!')For advanced TypeScript patterns and best practices, see our 📖 TypeScript Usage Guide
constspinner=ConsoleKit.spinner('Loading...')awaitspinner.start()// ... do workawaitspinner.succeed('Complete!')constspinner=ConsoleKit.spinner('Building...',{color: '255,100,150',// Custom RGB colorbackgroundColor: '#1a1a1a',// Custom hex backgroundbold: true,// Bold textitalic: true,// Italic textunderline: false,// No underlinespinner: ['⠋','⠙','⠹','⠸','⠼']// Custom animation})start(text?)- Start the spinner animationstop()- Stop the spinner and clear the linesucceed(text?)- Stop with success message ✔fail(text?)- Stop with error message ✖warn(text?)- Stop with warning message ⚠info(text?)- Stop with info message ℹupdateText(text)- Update spinner text while running
Predefined Styles:
dots- Classic dot animation (default) ⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏corners- Elegant corner rotation │┤┘└┐┌┴┬arrows- Directional arrows ←↖↑↗→↘↓↙triangles- Geometric triangles ◢◣◤◥circles- Smooth circle rotation ◐◑◒◓stars- Twinkling stars ★☆✯✰
Custom Styles:
constcustomSpinner=ConsoleKit.spinner('Custom...',{spinner: ['🌍','🌎','🌏']// Your own characters})constprogress=ConsoleKit.progress('Processing...',{total: 100})awaitprogress.start()// Update progressprogress.update(50)progress.increment(25)// Completeawaitprogress.succeed('Processing complete!')constprogress=ConsoleKit.progress('Building project...',{total: 1000,current: 0,style: 'blocks',// Visual stylecolor: 'green',// Progress bar colorbackgroundColor: '#1a1a1a',// Background colorbold: true,// Bold textitalic: false,// No italicunderline: true// Underlined text})Available Styles:
bar- Solid filled bar with empty blocks (████████░░)blocks- Square blocks pattern (▣▣▣▣▣▣▣▣▣▣)dots- Circular dots pattern (●●●●●●○○○○)
start(text?)- Start the progress barupdate(current)- Set specific progress valueincrement(amount)- Increase progress by amountcomplete()- Set to 100% and display completionsucceed(text?)- Complete with success message ✔fail(text?)- Complete with error message ✖warn(text?)- Complete with warning message ⚠info(text?)- Complete with info message ℹstop()- Stop the progress barupdateText(text)- Update progress text while running
File Upload Progress:
constprogress=ConsoleKit.progress('Uploading files...',{total: files.length,style: 'blocks',color: 'blue'})awaitprogress.start()for(leti=0;i<files.length;i++){awaituploadFile(files[i])progress.update(i+1)}awaitprogress.succeed('All files uploaded!')Data Processing with Updates:
constprogress=ConsoleKit.progress('Processing data...',{total: 1000,style: 'dots',color: 'green'})awaitprogress.start()// Process in batchesfor(leti=0;i<10;i++){awaitprocessBatch(i*100,(i+1)*100)progress.update((i+1)*100)// Update text for each batchprogress.updateText(`Processing batch ${i+1}/10...`)}awaitprogress.succeed('Data processing complete!')Multiple Concurrent Progress Bars:
consttasks=[{name: 'Task 1',total: 50,style: 'bar',color: 'green'},{name: 'Task 2',total: 30,style: 'blocks',color: 'blue'},{name: 'Task 3',total: 80,style: 'dots',color: 'yellow'}]constprogressBars=tasks.map(task=>ConsoleKit.progress(task.name,task))// Start all progress barsawaitPromise.all(progressBars.map(p=>p.start()))// Update them concurrentlyconstinterval=setInterval(()=>{progressBars.forEach((p,i)=>{constcurrent=Math.min(p.state.current+5,p.state.total)p.update(current)if(current>=p.state.total){p.succeed(`${tasks[i].name} complete!`)}})if(progressBars.every(p=>p.state.current>=p.state.total)){clearInterval(interval)}},200)Standard Colors:
black,red,green,yellow,blue,magenta,cyan,white,gray
Bright Variants:
brightBlack,brightRed,brightGreen,brightYellow,brightBlue,brightMagenta,brightCyan,brightWhite
Extended Colors:
orange,purple,pink,teal,indigo,lime,brown,gold
RGB Format:
color: '255,100,150'// Red: 255, Green: 100, Blue: 150
color: '0,255,0'// Pure green
color: '128,0,128'// PurpleHex Format:
color: '#FF0000'// Red
color: '#00FF00'// Green
color: '#0000FF'// Blue
color: '#FF6B9D'// Custom pinkBackground Colors:
backgroundColor: 'red'// Named background
backgroundColor: '255,255,0'// RGB background
backgroundColor: '#FFFF00'// Hex backgroundIndividual Styles:
bold: true// Bold text
italic: true// Italic text
underline: true// Underlined textCombined Styles:
{bold: true,italic: true,underline: false}Creates a new spinner instance with optional configuration.
Parameters:
text(string, optional) - Initial text to displayoptions(SpinnerOptions, optional) - Configuration object
Returns: Configured Spinner instance
Creates a new progress bar instance with required configuration.
Parameters:
text(string) - Initial text to displayoptions(ProgressOptions) - Configuration object (total is required)
Returns: Configured Progress instance
interfaceSpinnerOptions{text?: string// Display textstyle?: SpinnerAnimationStyle// Animation stylecolor?: ColorOption// Foreground colorbackgroundColor?: string// Background colorshow?: boolean// Visibility controlspinner?: string[]// Custom animation framesbold?: boolean// Bold textitalic?: boolean// Italic textunderline?: boolean// Underlined text}interfaceProgressOptions{text?: string// Display texttotal: number// Total value (required)current?: number// Current progress valuestyle?: ProgressBarStyle// Visual stylecolor?: ColorOption// Foreground colorbackgroundColor?: string// Background colorshow?: boolean// Visibility controlbold?: boolean// Bold textitalic?: boolean// Italic textunderline?: boolean// Underlined text}# Install dependencies
npm install
# Build the project
npm run build
# Run in development mode
npm run dev
# Lint and type check
npm run check-all
# Run all quality checks
npm run check-allsrc/
├── index.ts # Main export file
├── core/ # Core functionality
│ ├── ConsoleKit.ts # Main class with static methods
│ ├── Spinner.ts # Spinner implementation
│ └── Progress.ts # Progress bar implementation
├── interfaces/ # TypeScript type definitions
│ ├── Spinner.ts # All spinner-related interfaces
│ └── Progress.ts # All progress bar interfaces
└── utils/ # Utility functions
└── Colors.ts # Color and styling utilities
- Build Tools - Show compilation progress
- CLI Applications - User-friendly loading states
- Deployment Scripts - Visual feedback for long operations
- API Clients - Request status visualization
- File Operations - Upload/download progress
- Data Processing - Batch processing progress
- Build Systems - Compilation progress
- Database Operations - Query execution progress
- Network Requests - API call progress
- Installation Scripts - Package installation progress
- Strict Mode - Full TypeScript strict configuration enabled
- No Any Types - All types are explicitly defined
- Interface Segregation - Clean separation of concerns
- Path Aliases -
@core/*,@interfaces/*,@utils/*
For TypeScript patterns, type definitions, and implementation examples, see the detailed guide:
This guide covers:
- Type-safe configuration patterns
- Advanced generic types and constraints
- Custom error handling with TypeScript
- Real-world examples and production patterns
- Performance optimization techniques
MIT © NeaByteLab