Skip to content

xibbon/MiniTUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniTui

A minimal, high-performance Terminal User Interface framework for Swift.

CI Documentation

Features

  • Differential rendering with synchronized output (CSI 2026) for flicker-free updates
  • Component-based architecture with simple protocol-based API
  • Kitty keyboard protocol support with legacy fallback
  • Built-in components: Text, Input, Editor, Markdown, SelectList, SettingsList, Loader, Image, and more
  • Inline images via Kitty or iTerm2 protocols
  • Autocomplete for slash commands and file paths
  • Theming with customizable styling functions

Requirements

  • Swift 6.2+
  • macOS 13.0+

Installation

Add MiniTui to your Package.swift:

dependencies: [
    .package(url: "https://github.com/user/MiniTui.git", from: "1.0.0")
]

Then add it to your target:

.target(
    name: "MyApp",
    dependencies: ["MiniTui"]
)

Quick Start

import MiniTui

@main
struct Demo {
    @MainActor
    static func main() {
        let tui = TUI(terminal: ProcessTerminal())
        let output = Text("Type something and press Enter.", paddingX: 1, paddingY: 1)
        let input = Input()

        input.onSubmit = { text in
            output.setText("You typed: \(text)")
            tui.requestRender()
        }

        input.onEnd = {
            tui.stop()
            exit(0)
        }

        tui.addChild(output)
        tui.addChild(input)
        tui.setFocus(input)
        tui.start()

        RunLoop.main.run()
    }
}

Build

swift build

Run Demo

swift run MiniTuiDemo

Press Ctrl+D on empty input to exit.

Test

swift test

Documentation

Full documentation is available at MiniTui Documentation.

The documentation includes:

  • Getting Started - Installation, core concepts, your first app
  • Component Guide - All built-in components with examples
  • Tutorials - Build a chat interface, file browser, settings panel
  • Advanced Topics - Custom components, overlays, keyboard handling, performance
  • Reference - Themes, keys, terminal compatibility

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages