Sign in

    mizchi/tui/components does not have a README file

    AccordionItem

    pub(all) struct AccordionItem {
    id : String
    title : String
    content :
    Component

    expanded : Bool
    }

    Accordion item data

    ActionItem

    pub(all) struct ActionItem {
    key : Char
    label : String
    handler : () -> Unit
    }

    A single action item in the menu

    ActionItem::new

    fn ActionItem::new(key : Char, label : String, handler : () -> Unit) -> ActionItem

    Create an action item

    ActionMenu

    pub(all) struct ActionMenu {
    modal : ModalState
    title : String
    actions : Array[ActionItem]
    toggle_key : Char?
    on_close : () -> Unit
    }

    Action menu state and configuration

    ActionMenu::build

    fn ActionMenu::build(self : ActionMenu, container_width : Int, container_height : Int) ->
    Component

    Build the menu component

    ActionMenu::close

    fn ActionMenu::close(self : ActionMenu) -> Unit

    Close the menu

    ActionMenu::handle_escape

    fn ActionMenu::handle_escape(self : ActionMenu) -> Bool

    Handle escape key (closes menu)

    ActionMenu::handle_event

    Handle key event for action menu with automatic App buffer management Call this at the start of your key handler Returns MenuKeyResult indicating how the event was processed

    ActionMenu::handle_key

    fn ActionMenu::handle_key(self : ActionMenu, key : Char) -> Bool

    Handle a key event when menu is open Returns true if the key was handled, false otherwise

    ActionMenu::is_open

    fn ActionMenu::is_open(self : ActionMenu) -> Bool

    Check if menu is open

    ActionMenu::new

    fn ActionMenu::new(title : String, actions : Array[ActionItem], toggle_key? : Char?, on_close? : () -> Unit) -> ActionMenu

    Create a new action menu

    ActionMenu::open

    fn ActionMenu::open(self : ActionMenu) -> Unit

    Open the menu

    ActionMenu::open_with_app

    fn ActionMenu::open_with_app(self : ActionMenu, app :
    App
    ) -> Unit

    Open the menu and clear app buffer for clean render

    ButtonState

    pub(all) enum ButtonState {
    Normal
    Hover
    Pressed
    Focused
    Disabled
    }

    Button state for visual feedback

    ComboboxOption

    pub(all) struct ComboboxOption {
    id : String
    label : String
    }

    Combobox option

    ComboboxState

    pub(all) enum ComboboxState {
    Closed
    Open
    Editing
    Disabled
    }

    Combobox state

    CursorPosition

    pub(all) struct CursorPosition {
    row : Int
    col : Int
    }

    Cursor position (1-indexed)

    CursorPosition::new

    fn CursorPosition::new(row? : Int, col? : Int) -> CursorPosition

    Create cursor position

    EditConfig

    pub(all) struct EditConfig {
    field_name : String
    on_change : (String) -> Unit
    on_edit_start : () -> Unit?
    on_edit_end : () -> Unit?
    on_force_quit : () -> Unit?
    }

    Configuration for editable input behavior

    EditContext

    pub(all) struct EditContext {
    focused_id :
    Signal
    [String]
    configs : Map[String, EditConfig]
    restore_tui : () -> Unit
    }

    Context for managing multiple editable fields

    EditContext::edit

    fn EditContext::edit(self : EditContext, id : String, current_value : String) -> Bool

    Start editing a specific field by ID

    EditContext::edit_focused

    fn EditContext::edit_focused(self : EditContext) -> Bool

    Start editing the currently focused field

    EditContext::new

    fn EditContext::new(focused_id :
    Signal
    [String], restore_tui : () -> Unit) -> EditContext

    Create a new edit context

    EditContext::register

    fn EditContext::register(self : EditContext, id : String, config : EditConfig) -> Unit

    Register a field with the context

    EditorState

    pub(all) struct EditorState {
    buffer : TextBuffer
    undo_stack : UndoStack
    filename : String
    mode : SelectionMode
    modified : Bool
    }

    Editor state

    EditorState::from_file

    fn EditorState::from_file(path : String) -> EditorState

    Create editor state from file (not yet implemented)

    EditorState::new

    Create empty editor state

    FocusNav

    pub(all) struct FocusNav {
    focused_id :
    Signal
    [String]
    ids : Array[String]
    }

    Focus navigation state with signal-based tracking

    FocusNav::blur

    fn FocusNav::blur(self : FocusNav) -> Unit

    Clear focus

    FocusNav::button_state

    fn FocusNav::button_state(self : FocusNav, id : String) -> ButtonState

    Get ButtonState for a button component

    FocusNav::focused_in

    fn FocusNav::focused_in(self : FocusNav, ids : Array[String]) -> Bool

    Check if the focused ID is in a specific list

    FocusNav::get

    fn FocusNav::get(self : FocusNav) -> String

    Get the currently focused ID (empty string if none)

    FocusNav::handle_arrows

    fn FocusNav::handle_arrows(self : FocusNav, event :
    InputEvent
    ) -> Bool

    Handle arrow key navigation (Up/Down) Returns true if the event was handled

    FocusNav::handle_tab

    fn FocusNav::handle_tab(self : FocusNav, event :
    InputEvent
    ) -> Bool

    Handle Tab/Shift+Tab navigation events Returns true if the event was handled

    FocusNav::input_state

    fn FocusNav::input_state(self : FocusNav, id : String) -> InputState

    Get InputState for an input component

    FocusNav::is_focused

    fn FocusNav::is_focused(self : FocusNav, id : String) -> Bool

    Check if an ID is currently focused

    FocusNav::new

    fn FocusNav::new(ids : Array[String]) -> FocusNav

    Create a new focus navigation helper

    FocusNav::next

    fn FocusNav::next(self : FocusNav) -> Unit

    Move focus to the next item (wraps around)

    FocusNav::prev

    fn FocusNav::prev(self : FocusNav) -> Unit

    Move focus to the previous item (wraps around)

    FocusNav::set

    fn FocusNav::set(self : FocusNav, id : String) -> Unit

    Set focus to a specific ID

    FocusNav::textarea_state

    fn FocusNav::textarea_state(self : FocusNav, id : String) -> TextareaState

    Get TextareaState for a textarea component

    FocusNav::with_initial

    fn FocusNav::with_initial(ids : Array[String], initial : String) -> FocusNav

    Create with initial focus

    HeadlessApp

    pub(all) struct HeadlessApp {
    width : Int
    height : Int
    output : String
    }

    Headless app instance

    HeadlessApp::ansi_output

    fn HeadlessApp::ansi_output(self : HeadlessApp) -> String

    Get ANSI output (for debugging)

    HeadlessApp::content

    fn HeadlessApp::content(self : HeadlessApp) -> String

    Get text content (similar to playwright's page.content())

    HeadlessApp::locator

    fn HeadlessApp::locator(_self : HeadlessApp, id : String) -> Locator

    Find component by ID

    HeadlessApp::new

    fn HeadlessApp::new(width? : Int, height? : Int) -> HeadlessApp

    Create headless app

    HeadlessApp::render

    Render component and get output

    ImeSession

    pub(all) struct ImeSession {
    is_editing :
    Signal
    [Bool]
    }

    ImeSession::is_editing

    fn ImeSession::is_editing(self : ImeSession) -> Bool

    ImeSession::new

    fn ImeSession::new() -> ImeSession

    ImeSession::start

    fn ImeSession::start(self : ImeSession, config : EditConfig, current_value : String, on_complete : () -> Unit, confirm_on_shift_enter? : Bool, esc_cancels? : Bool) -> Unit

    InputState

    pub(all) enum InputState {
    Idle
    Focused
    Editing
    Disabled
    }

    Input state for visual feedback

    ItemScroller

    pub(all) struct ItemScroller {
    offset :
    Signal
    [Int]
    auto_scroll :
    Signal
    [Bool]
    }

    Simple item scroller state

    ItemScroller::can_scroll_down

    fn ItemScroller::can_scroll_down(self : ItemScroller, total_items : Int, visible_count : Int) -> Bool

    Check if can scroll down

    ItemScroller::can_scroll_up

    fn ItemScroller::can_scroll_up(self : ItemScroller) -> Bool

    Check if can scroll up

    ItemScroller::down

    fn ItemScroller::down(self : ItemScroller, n : Int, total_items : Int, visible_count : Int) -> Bool

    Scroll down by n items

    ItemScroller::follow_bottom

    fn ItemScroller::follow_bottom(self : ItemScroller, total_items : Int, visible_count : Int) -> Unit

    Auto-scroll to bottom if enabled

    ItemScroller::indicator

    fn ItemScroller::indicator(self : ItemScroller, total_items : Int, visible_count : Int) -> ScrollIndicator

    Scroll indicator for item scroller

    ItemScroller::new

    ItemScroller::slice

    fn[T] ItemScroller::slice(self : ItemScroller, items : Array[T], visible_count : Int) -> Array[T]

    Get visible slice of items

    ItemScroller::to_bottom

    fn ItemScroller::to_bottom(self : ItemScroller, total_items : Int, visible_count : Int) -> Unit

    Jump to bottom

    ItemScroller::up

    fn ItemScroller::up(self : ItemScroller, n : Int) -> Bool

    Scroll up by n items

    Keyboard

    pub(all) struct Keyboard {
    app : HeadlessApp
    }

    Keyboard object for detailed input

    Keyboard::press

    fn Keyboard::press(self : Keyboard, _key_name : String) -> Keyboard

    Press key by name (placeholder for future input handling)

    Keyboard::type_text

    fn Keyboard::type_text(self : Keyboard, _text : String) -> Keyboard

    Type text (placeholder for future input handling)

    LabelPosition

    pub(all) enum LabelPosition {
    Left
    Right
    }

    Label position for switch

    LineScroller

    pub(all) struct LineScroller {
    offset :
    Signal
    [Int]
    auto_scroll :
    Signal
    [Bool]
    }

    Line scroller state

    LineScroller::can_scroll_down

    fn LineScroller::can_scroll_down(self : LineScroller, total_lines : Int, visible_height : Int) -> Bool

    Check if can scroll down

    LineScroller::can_scroll_up

    fn LineScroller::can_scroll_up(self : LineScroller) -> Bool

    Check if can scroll up

    LineScroller::down

    fn LineScroller::down(self : LineScroller, n : Int, total_lines : Int, visible_height : Int) -> Bool

    Scroll down by n lines

    LineScroller::follow_bottom

    fn LineScroller::follow_bottom(self : LineScroller, total_lines : Int, visible_height : Int) -> Unit

    Auto-scroll to bottom if enabled

    LineScroller::new

    LineScroller::slice

    fn[T] LineScroller::slice(self : LineScroller, items : Array[T], heights : Array[Int], visible_height : Int) -> Array[T]

    Simpler slice that returns just the visible items (without partial item handling)

    LineScroller::slice_with_offset

    fn[T] LineScroller::slice_with_offset(self : LineScroller, items : Array[T], heights : Array[Int], visible_height : Int) -> (Array[T], Int)

    Get visible slice of items based on line offset Returns (items_to_show, skip_lines_in_first_item) heights: array of line heights for each item visible_height: number of lines to show

    LineScroller::to_bottom

    fn LineScroller::to_bottom(self : LineScroller, total_lines : Int, visible_height : Int) -> Unit

    Jump to bottom

    LineScroller::up

    fn LineScroller::up(self : LineScroller, n : Int) -> Bool

    Scroll up by n lines

    ListboxOption

    pub(all) struct ListboxOption {
    id : String
    label : String
    disabled : Bool
    }

    Listbox option
    impl Eq for ListboxOption

    ListboxOrientation

    pub(all) enum ListboxOrientation {
    Vertical
    Horizontal
    }

    Listbox orientation

    ListboxState

    pub(all) struct ListboxState {
    focused_id : String
    selected_ids : Array[String]
    anchor_id : String
    }

    Listbox state

    ListboxState::new

    fn ListboxState::new(initial_selected? : Array[String]) -> ListboxState

    Create initial listbox state

    Locator

    pub(all) struct Locator {
    id : String
    }

    Locator for finding components by ID
    pub(all) struct MenuItem {
    id : String
    label : String
    item_type : MenuItemType
    disabled : Bool
    }

    Menu item
    pub(all) enum MenuItemType {
    Action
    Checkbox(Bool)
    Radio(Bool)
    Separator
    Submenu(Array[MenuItem])
    }

    Menu item type
    pub(all) enum MenuKeyResult {
    Handled
    NotHandled
    Closed
    }

    Result of handling a key event with action menu
    pub(all) struct MenubarItem {
    id : String
    label : String
    items : Array[MenuItem]
    }

    Top-level menubar item
    pub(all) struct MenubarState {
    open_menu_id : String
    focused_item_id : String
    open_submenu_path : Array[String]
    }

    Menubar state

    Create initial menubar state

    ModalState

    pub(all) struct ModalState {
    is_open :
    Signal
    [Bool]
    }

    Modal state for controlling visibility

    ModalState::close

    fn ModalState::close(self : ModalState) -> Unit

    Close the modal

    ModalState::get_is_open

    fn ModalState::get_is_open(self : ModalState) -> Bool

    Check if the modal is open

    ModalState::new

    fn ModalState::new(initial_open? : Bool) -> ModalState

    Create a new modal state

    ModalState::open

    fn ModalState::open(self : ModalState) -> Unit

    Open the modal

    ModalState::toggle

    fn ModalState::toggle(self : ModalState) -> Unit

    Toggle the modal open/closed

    Page

    pub(all) struct Page {
    app : HeadlessApp
    }

    Page-level operations (Playwright style)

    Page::content

    fn Page::content(self : Page) -> String

    Get full page content

    Page::keyboard

    fn Page::keyboard(self : Page) -> Keyboard

    Get keyboard for page

    Page::locator

    fn Page::locator(self : Page, id : String) -> Locator

    Locator by ID

    Page::new

    fn Page::new(app : HeadlessApp) -> Page

    Create page from app

    ProgressStyle

    pub(all) enum ProgressStyle {
    Bar
    Dots
    Blocks
    Spinner
    }

    Progress bar style

    Queue

    pub(all) struct Queue[T] {
    items : Array[T]
    is_processing : Ref[Bool]
    }

    Generic queue for storing items while a task is running Useful for batching user inputs, commands, or any items during async operations

    Queue::clear

    fn[T] Queue::clear(self : Queue[T]) -> Unit

    Clear all items from the queue

    Queue::dequeue_all

    fn[T] Queue::dequeue_all(self : Queue[T]) -> Array[T]

    Remove and return all items from the queue

    Queue::enqueue

    fn[T] Queue::enqueue(self : Queue[T], item : T) -> Unit

    Add an item to the queue

    Queue::finish_processing

    fn[T] Queue::finish_processing(self : Queue[T]) -> Unit

    Mark processing as finished

    Queue::is_busy

    fn[T] Queue::is_busy(self : Queue[T]) -> Bool

    Check if currently processing

    Queue::is_empty

    fn[T] Queue::is_empty(self : Queue[T]) -> Bool

    Check if the queue is empty

    Queue::length

    fn[T] Queue::length(self : Queue[T]) -> Int

    Get the number of items in the queue

    Queue::new

    fn[T] Queue::new() -> Queue[T]

    Queue::peek_all

    fn[T] Queue::peek_all(self : Queue[T]) -> Array[T]

    Get a copy of all items without removing them

    Queue::start_processing

    fn[T] Queue::start_processing(self : Queue[T]) -> Unit

    Mark processing as started

    RadioOption

    pub(all) struct RadioOption {
    id : String
    label : String
    }

    Radio option data
    impl Eq for RadioOption

    RadioOrientation

    pub(all) enum RadioOrientation {
    Horizontal
    Vertical
    }

    Radio group orientation

    ScrollIndicator

    pub(all) enum ScrollIndicator {
    None
    Up
    Down
    Both
    }

    Scroll indicator type

    ScrollState

    pub(all) struct ScrollState {
    offset :
    Signal
    [Int]
    auto_scroll :
    Signal
    [Bool]
    }

    Scroll state for managing scrollable content

    ScrollState::auto_scroll_to_bottom

    fn ScrollState::auto_scroll_to_bottom(self : ScrollState, total_lines : Int, visible_height : Int) -> Unit

    Auto-scroll to bottom if enabled Call this when new content is added

    ScrollState::get_indicator

    fn ScrollState::get_indicator(self : ScrollState, total_lines : Int, visible_height : Int) -> ScrollIndicator

    Get scroll indicator based on current position

    ScrollState::is_at_bottom

    fn ScrollState::is_at_bottom(self : ScrollState, total_lines : Int, visible_height : Int) -> Bool

    Check if scroll is at bottom

    ScrollState::new

    Create a new scroll state

    ScrollState::reset

    fn ScrollState::reset(self : ScrollState) -> Unit

    Reset scroll state (scroll to top, enable auto-scroll)

    ScrollState::scroll_down

    fn ScrollState::scroll_down(self : ScrollState, amount : Int, total_lines : Int, visible_height : Int) -> Bool

    Scroll down by given amount Returns true if scroll position changed

    ScrollState::scroll_to_bottom

    fn ScrollState::scroll_to_bottom(self : ScrollState, total_lines : Int, visible_height : Int) -> Unit

    Scroll to bottom

    ScrollState::scroll_up

    fn ScrollState::scroll_up(self : ScrollState, amount : Int) -> Bool

    Scroll up by given amount Returns true if scroll position changed

    ScrollState::with_values

    fn ScrollState::with_values(offset : Int, auto_scroll : Bool) -> ScrollState

    Create scroll state with initial values

    ScrollableView

    pub(all) struct ScrollableView {
    lines : Ref[Array[StyledLine]]
    offset :
    Signal
    [Int]
    auto_scroll :
    Signal
    [Bool]
    width : Ref[Int]
    visible_height : Ref[Int]
    }

    ScrollableView state

    ScrollableView::can_scroll_down

    fn ScrollableView::can_scroll_down(self : ScrollableView) -> Bool

    Check if can scroll down

    ScrollableView::can_scroll_up

    fn ScrollableView::can_scroll_up(self : ScrollableView) -> Bool

    Check if can scroll up

    ScrollableView::down

    fn ScrollableView::down(self : ScrollableView, n : Int) -> Bool

    Scroll down by n lines

    ScrollableView::follow_bottom

    fn ScrollableView::follow_bottom(self : ScrollableView) -> Unit

    Follow bottom (auto-scroll when enabled)

    ScrollableView::get_visible_height

    fn ScrollableView::get_visible_height(self : ScrollableView) -> Int

    Get visible height

    ScrollableView::get_width

    fn ScrollableView::get_width(self : ScrollableView) -> Int

    Get width

    ScrollableView::max_offset

    fn ScrollableView::max_offset(self : ScrollableView) -> Int

    Get max scroll offset

    ScrollableView::new

    fn ScrollableView::new(width : Int, visible_height : Int) -> ScrollableView

    ScrollableView::resize

    fn ScrollableView::resize(self : ScrollableView, width : Int, visible_height : Int) -> Unit

    ScrollableView::set_lines

    fn ScrollableView::set_lines(self : ScrollableView, lines : Array[StyledLine]) -> Unit

    Set content lines

    ScrollableView::to_bottom

    fn ScrollableView::to_bottom(self : ScrollableView) -> Unit

    Jump to bottom

    ScrollableView::total_lines

    fn ScrollableView::total_lines(self : ScrollableView) -> Int

    Get total line count

    ScrollableView::up

    fn ScrollableView::up(self : ScrollableView, n : Int) -> Bool

    Scroll up by n lines

    Selection

    pub(all) struct Selection {
    anchor : CursorPosition
    cursor : CursorPosition
    }

    Selection range

    Selection::is_empty

    fn Selection::is_empty(self : Selection) -> Bool

    Check if selection is empty

    SelectionMode

    pub(all) enum SelectionMode {
    Caret
    VisualChar
    VisualLine
    VisualBlock
    }

    Selection mode

    SplitDirection

    pub(all) enum SplitDirection {
    Horizontal
    Vertical
    }

    Split direction

    SplitSize

    pub(all) enum SplitSize {
    Fixed(Double)
    Percent(Double)
    Flex(Double)
    }

    Split size specification

    SplitterOrientation

    pub(all) enum SplitterOrientation {
    Horizontal
    Vertical
    }

    Splitter orientation

    SplitterState

    pub(all) struct SplitterState {
    position : Int
    collapsed : Bool
    prev_position : Int
    focused : Bool
    }

    Splitter state

    SplitterState::new

    fn SplitterState::new(initial_position? : Int, collapsed? : Bool) -> SplitterState

    Create initial splitter state

    StreamBuffer

    pub(all) struct StreamBuffer {
    app : Ref[
    App
    ]
    width : Ref[Int]
    height : Ref[Int]
    }

    StreamBuffer::clear

    fn StreamBuffer::clear(self : StreamBuffer) -> Unit

    StreamBuffer::new

    fn StreamBuffer::new(width : Int, height : Int) -> StreamBuffer

    StreamBuffer::render

    fn StreamBuffer::render(self : StreamBuffer, component :
    Component
    , row? : Int, col? : Int, preserve_cursor? : Bool) -> Unit

    Render component at 0-indexed row/col while preserving cursor position

    StreamBuffer::render_output

    fn StreamBuffer::render_output(self : StreamBuffer, component :
    Component
    , row? : Int, col? : Int, preserve_cursor? : Bool) -> String

    StreamBuffer::resize

    fn StreamBuffer::resize(self : StreamBuffer, width : Int, height : Int) -> Unit

    StreamBuffer::size

    fn StreamBuffer::size(self : StreamBuffer) -> (Int, Int)

    StreamBuffer::sync

    fn StreamBuffer::sync(self : StreamBuffer, component :
    Component
    ) -> Unit

    StreamingState

    pub(all) struct StreamingState {
    full_text :
    Signal
    [String]
    position :
    Signal
    [Int]
    ticker_id : Ref[Int]
    }

    Streaming state for managing streaming text display

    StreamingState::append

    fn StreamingState::append(self : StreamingState, chunk : String) -> Unit

    Append text chunk for real-time streaming (e.g., from API) Unlike start(), this immediately shows appended text

    StreamingState::clear

    fn StreamingState::clear(self : StreamingState) -> Unit

    Clear streaming state (stop and reset)

    StreamingState::complete

    fn StreamingState::complete(self : StreamingState) -> Unit

    Complete streaming immediately (show all text)

    StreamingState::get_partial

    fn StreamingState::get_partial(self : StreamingState) -> String

    Get the partial text (up to current position)

    StreamingState::get_partial_with_cursor

    fn StreamingState::get_partial_with_cursor(self : StreamingState, cursor? : String) -> String

    Get the partial text with cursor

    StreamingState::get_progress

    fn StreamingState::get_progress(self : StreamingState) -> (Int, Int)

    Get progress as (current, total)

    StreamingState::get_progress_ratio

    fn StreamingState::get_progress_ratio(self : StreamingState) -> Double

    Get progress as percentage (0.0 to 1.0)

    StreamingState::has_content

    fn StreamingState::has_content(self : StreamingState) -> Bool

    Check if streaming has content (either in progress or completed but not cleared)

    StreamingState::is_streaming

    fn StreamingState::is_streaming(self : StreamingState) -> Bool

    Check if streaming is in progress

    StreamingState::new

    Create a new streaming state

    StreamingState::start

    fn StreamingState::start(self : StreamingState, text : String, interval_ms : Int, on_tick : () -> Unit, on_complete : () -> Unit) -> Bool

    Start streaming text with given interval Returns true if streaming started, false if already streaming on_tick is called after each character advance on_complete is called when streaming finishes

    StreamingState::start_realtime

    fn StreamingState::start_realtime(self : StreamingState) -> Bool

    Start real-time streaming mode (for API streaming) Call append() to add chunks, then call complete() when done

    StreamingState::stop

    fn StreamingState::stop(self : StreamingState) -> Unit

    Stop streaming and clear the ticker

    StreamingState::take

    fn StreamingState::take(self : StreamingState) -> String

    Get the full text and clear the state Useful for adding completed text to a message list

    StreamingState::take_partial

    fn StreamingState::take_partial(self : StreamingState) -> String

    Get the partial text (up to current position) and clear the state Useful for interrupting streaming and keeping what was shown

    StyledLine

    pub(all) struct StyledLine {
    content : String
    fg :
    Color

    bold : Bool
    }

    A line with color styling

    StyledLine::new

    fn StyledLine::new(content : String, fg? :
    Color
    , bold? : Bool) -> StyledLine

    StyledLine::plain

    fn StyledLine::plain(content : String) -> StyledLine

    SwitchState

    pub(all) enum SwitchState {
    Off
    On
    Focused
    Disabled
    }

    Switch state

    TabItem

    pub(all) struct TabItem {
    label : String
    id : String
    }

    Tab item data
    impl Eq for TabItem

    TabOrientation

    pub(all) enum TabOrientation {
    Horizontal
    Vertical
    }

    Tab orientation

    TextAlign

    pub(all) enum TextAlign {
    Left
    Right
    Center
    }

    Text alignment options

    TextBuffer

    pub(all) struct TextBuffer {
    lines : Array[String]
    cursor : CursorPosition
    selection : Selection
    mode : SelectionMode
    modified : Bool
    }

    Text buffer state

    TextBuffer::current_line

    fn TextBuffer::current_line(self : TextBuffer) -> String

    Get current line text

    TextBuffer::cursor

    fn TextBuffer::cursor(self : TextBuffer) -> CursorPosition

    Get current cursor position

    TextBuffer::delete_backwards

    fn TextBuffer::delete_backwards(self : TextBuffer) -> TextBuffer

    Delete character before cursor (backspace)

    TextBuffer::delete_forwards

    fn TextBuffer::delete_forwards(self : TextBuffer) -> TextBuffer

    Delete character at cursor (delete key)

    TextBuffer::delete_line

    fn TextBuffer::delete_line(self : TextBuffer) -> TextBuffer

    Delete current line

    TextBuffer::from_file

    fn TextBuffer::from_file(_path : String) -> TextBuffer

    Create text buffer from file (not yet implemented)

    TextBuffer::from_string

    fn TextBuffer::from_string(text : String) -> TextBuffer

    Create text buffer from string (preserves \n line endings)

    TextBuffer::insert_char

    fn TextBuffer::insert_char(self : TextBuffer, ch : Char) -> TextBuffer

    Insert character at cursor

    TextBuffer::insert_newline

    fn TextBuffer::insert_newline(self : TextBuffer) -> TextBuffer

    Insert newline at cursor

    TextBuffer::insert_string

    fn TextBuffer::insert_string(self : TextBuffer, text : String) -> TextBuffer

    Insert string at cursor

    TextBuffer::line_count

    fn TextBuffer::line_count(self : TextBuffer) -> Int

    Get line count

    TextBuffer::move_to

    fn TextBuffer::move_to(self : TextBuffer, row : Int, col : Int) -> TextBuffer

    Move cursor to position

    TextBuffer::new

    fn TextBuffer::new() -> TextBuffer

    Create empty text buffer

    TextBuffer::to_string

    fn TextBuffer::to_string(self : TextBuffer) -> String

    Get full text as string

    TextareaState

    pub(all) enum TextareaState {
    Idle
    Focused
    Editing
    Disabled
    }

    Textarea state for visual feedback

    Theme

    Color palette for a theme

    Theme::dark

    fn Theme::dark(primary? :
    Color
    ) -> Theme

    Create a dark theme with optional primary color

    Theme::default

    fn Theme::default() -> Theme

    Default theme (dark mode)

    Theme::focused_color

    fn Theme::focused_color(self : Theme) ->
    Color

    Get color for focused state

    Theme::interactive_color

    fn Theme::interactive_color(self : Theme) ->
    Color

    Get color for normal interactive elements

    Theme::light

    fn Theme::light(primary? :
    Color
    ) -> Theme

    Create a light theme with optional primary color

    Theme::selected_color

    fn Theme::selected_color(self : Theme) ->
    Color

    Get color for selected/active state (uses focus for visibility)

    ThemeMode

    pub(all) enum ThemeMode {
    Light
    Dark
    }

    Theme mode

    UndoStack

    pub(all) struct UndoStack {
    history : Array[String]
    max_size : Int
    }

    Undo/Redo stack

    UndoStack::new

    fn UndoStack::new() -> UndoStack

    Create empty undo stack

    UndoStack::push

    fn UndoStack::push(self : UndoStack, op : String) -> UndoStack

    Add operation to history

    UndoStack::redo_count

    fn UndoStack::redo_count(_self : UndoStack) -> Int

    Get redo count

    UndoStack::undo_count

    fn UndoStack::undo_count(self : UndoStack) -> Int

    Get undo count

    accordion

    fn accordion(items : Array[AccordionItem], id? : String, focused_id? : String, theme? : Theme, expanded_icon? : String, collapsed_icon? : String, content_padding? : Double, gap? : Double) ->
    Component

    Create an accordion component with theme support

    Visual design:
    • Collapsed: ▶ Section Title
    • Expanded: ▼ Section Title (highlighted) ┌─────────────────┐ │ Content here │ └─────────────────┘

    accordion_header

    fn accordion_header(title : String, expanded : Bool, id? : String, focused? : Bool, theme? : Theme, expanded_icon? : String, collapsed_icon? : String, padding_x? : Double, padding_y? : Double, on_click? : () -> Unit?) ->
    Component

    Single accordion section (header only) with theme support

    alert_dialog

    fn alert_dialog(message : String, title? : String, button_label? : String, bg? :
    Color
    , border_color? :
    Color
    ) ->
    Component

    Alert dialog modal (single button)

    align_center

    Center items in the container

    align_end

    Align items to the end of the container

    align_space_around

    fn align_space_around() ->
    Alignment

    Distribute items with equal space around them

    align_space_between

    fn align_space_between() ->
    Alignment

    Distribute items with equal space between them

    align_space_evenly

    fn align_space_evenly() ->
    Alignment

    Distribute items with equal space (including edges)

    align_start

    Align items to the start of the container

    align_stretch

    Stretch items to fill the container

    align_text

    fn align_text(s : String, width : Int, align? : TextAlign) -> String

    Align text within given width

    ansi_move_to

    fn ansi_move_to(row : Int, col : Int) -> String

    ANSI escape: move cursor to row, col (0-indexed input, 1-indexed output)

    ansi_restore_cursor

    fn ansi_restore_cursor() -> String

    ANSI escape: restore cursor position

    ansi_save_cursor

    fn ansi_save_cursor() -> String

    ANSI escape: save cursor position

    apply_scroll

    fn[T] apply_scroll(items : Array[T], offset : Int, visible_height : Int, reserve_indicator? : Bool) -> Array[T]

    Apply scroll offset to an array of items Returns the visible slice based on scroll offset and visible height

    autocomplete

    fn autocomplete(options : Array[ComboboxOption], value : String, id? : String, focused_id? : String, placeholder? : String, theme? : Theme, min_width? : Double, max_visible? : Int) ->
    Component

    Autocomplete input (text input with suggestions) with theme support

    backdrop

    Create a backdrop overlay that fills the available space Used as a semi-transparent background behind modals

    bold

    fn bold(content : String) ->
    Component

    Bold text

    build_progress_bar

    fn build_progress_bar(ratio : Double, width : Int, style? : ProgressStyle, show_percent? : Bool) -> String

    Build progress bar string ratio: 0.0 to 1.0 width: total width in characters

    build_scrollbar

    fn build_scrollbar(offset : Int, total_items : Int, visible_count : Int, height : Int, track_char? : String, thumb_char? : String) -> Array[String]

    Build a vertical scrollbar string for the given height Returns an array of single-character strings, one per line

    button

    fn button(label : String, id? : String, state? : ButtonState, theme? : Theme, min_width? : Double, padding_x? : Double, padding_y? : Double, on_click? : () -> Unit?) ->
    Component

    Create a button component with theme support

    Uses border color for state differentiation (not background).
    • Normal: theme.primary border
    • Hover: theme.primary border (brighter fg)
    • Focused: theme.focus (yellow) border
    • Pressed: theme.primary border (dimmed)
    • Disabled: theme.disabled border and fg

    calc_labeled_block_lines

    fn calc_labeled_block_lines(content : String, width : Int, indent : String) -> Int

    Calculate height for a labeled block (icon + label + content) indent: indentation string (e.g. " ")

    calc_max_scroll

    fn calc_max_scroll(total_lines : Int, visible_height : Int, reserve_indicator? : Bool) -> Int

    Calculate max scroll offset total_lines: total number of content lines visible_height: number of visible lines (excluding scroll indicator) reserve_indicator: whether to reserve 1 line for scroll indicator

    calc_split_sizes

    fn calc_split_sizes(total : Int, first : SplitSize, second : SplitSize, divider_size? : Int) -> (Int, Int)

    Calculate actual sizes for split pane Returns (first_size, second_size)

    calc_text_lines

    fn calc_text_lines(text : String, width : Int) -> Int

    Calculate line height for text content width: available width for text text: the text content

    card

    Card - rounded border with padding, commonly used for UI panels

    center

    Center content within available space Uses flex_grow=1.0 to fill parent container

    checkbox

    fn checkbox(checked : Bool, id? : String, focused? : Bool, disabled? : Bool, theme? : Theme, checked_icon? : String, unchecked_icon? : String, on_click? : () -> Unit?) ->
    Component

    Checkbox-style toggle (square)

    colored

    Colored text

    column

    fn column(children : Array[
    Component
    ], id? : String, width? :
    Dimension
    , height? :
    Dimension
    , min_width? :
    Dimension
    , min_height? :
    Dimension
    , max_width? :
    Dimension
    , max_height? :
    Dimension
    , flex_grow? : Double, flex_shrink? : Double, flex_basis? :
    Dimension
    , justify? :
    Alignment
    , align? :
    Alignment
    , wrap? : Bool, gap? : Double, padding? : Double, padding_x? : Double, padding_y? : Double, margin? : Double, margin_x? : Double, margin_y? : Double, border? :
    BorderChars
    ?, border_color? :
    Color
    , bg? :
    Color
    , fg? :
    Color
    , on_click? : () -> Unit?, role? :
    Role
    ?) ->
    Component

    Create a vertical column container

    combobox

    fn combobox(options : Array[ComboboxOption], selected_id : String, id? : String, focused_id? : String, state? : ComboboxState, filter? : String, placeholder? : String, theme? : Theme, width? :
    Dimension
    , min_width? : Double, max_visible? : Int, dropdown_icon? : String, dropdown_icon_open? : String) ->
    Component

    Create a combobox component with theme support

    confirm_dialog

    fn confirm_dialog(message : String, title? : String, confirm_label? : String, cancel_label? : String, bg? :
    Color
    , border_color? :
    Color
    ) ->
    Component

    Confirmation dialog modal

    context_menu

    fn context_menu(items : Array[MenuItem], focused_id? : String, id? : String, theme? : Theme, min_width? : Double) ->
    Component

    Context menu (positioned menu) with theme support

    count_lines

    fn count_lines(text : String) -> Int

    Count lines in text

    dim_auto

    Auto dimension - size based on content

    dim_length

    fn dim_length(value : Double) ->
    Dimension

    Create a fixed-length dimension in characters/pixels

    dim_percent

    fn dim_percent(value : Double) ->
    Dimension

    Create a percentage-based dimension (0.0 to 100.0) Converts user-friendly percentage (e.g., 100.0 = 100%) to crater's normalized form (1.0 = 100%)

    editor

    fn editor(state : EditorState, fg :
    Color
    , bg :
    Color
    , gutter_bg :
    Color
    , line_fg :
    Color
    , line_bg :
    Color
    , min_width : Double, min_height : Double, show_status : Bool, status_message : String) ->
    Component

    Main editor component

    Footer - typically at bottom of screen for instructions/hints

    form_edit_config

    fn form_edit_config(field_name : String, signal :
    Signal
    [String], on_edit_start? : () -> Unit?, on_edit_end? : () -> Unit?, on_force_quit? : () -> Unit?) -> EditConfig

    Helper to create a standard edit config for form fields

    fraction_text

    fn fraction_text(current : Int, total : Int, theme? : Theme) ->
    Component

    Fraction text with theme support (e.g., "5/10")

    fullscreen

    fn fullscreen(children : Array[
    Component
    ], width : Int, height : Int, border? :
    BorderChars
    ?, border_color? :
    Color
    , padding? : Double) ->
    Component

    Full screen container - fills entire terminal with optional border

    get_spinner_frame

    fn get_spinner_frame(tick : Int) -> String

    Get spinner frame for animation

    grid

    fn grid(children : Array[
    Component
    ], columns? : Int, column_gap? : Double, row_gap? : Double, width? :
    Dimension
    , height? :
    Dimension
    , min_width? :
    Dimension
    , min_height? :
    Dimension
    , max_width? :
    Dimension
    , max_height? :
    Dimension
    , justify_items? :
    Alignment
    , align_items? :
    Alignment
    , padding? : Double, padding_x? : Double, padding_y? : Double, margin? : Double, margin_x? : Double, margin_y? : Double, border? :
    BorderChars
    ?, border_color? :
    Color
    , bg? :
    Color
    , fg? :
    Color
    ) ->
    Component

    Create a grid layout using nested Row/Column This simulates CSS Grid using flexbox

    hdivider

    fn hdivider(char? : Char, fg? :
    Color
    , width? : Int) ->
    Component

    Horizontal divider line (1 row height, fills width)

    hspace

    fn hspace(width : Double) ->
    Component

    Fixed-width horizontal spacer

    hsplit

    fn hsplit(top : Array[
    Component
    ], bottom : Array[
    Component
    ], total_height : Int, top_size : SplitSize, bottom_size : SplitSize, divider? :
    Component
    ?, divider_size? : Int) ->
    Component

    Horizontal split pane (top and bottom)

    hsplit_fixed_bottom

    fn hsplit_fixed_bottom(top : Array[
    Component
    ], bottom : Array[
    Component
    ], total_height : Int, bottom_height : Int, divider? :
    Component
    ?) ->
    Component

    Simple horizontal split with fixed bottom height

    hsplit_fixed_top

    Simple horizontal split with fixed top height

    icon_button

    fn icon_button(icon : String, state? : ButtonState, theme? : Theme) ->
    Component

    Icon button (single character or emoji)

    ime_input

    fn ime_input(value : String, is_editing : Bool, focused? : Bool, disabled? : Bool, id? : String, placeholder? : String, fg? :
    Color
    , bg? :
    Color
    , placeholder_fg? :
    Color
    , focus_border_color? :
    Color
    , edit_border_color? :
    Color
    , disabled_fg? :
    Color
    , disabled_bg? :
    Color
    , width? :
    Dimension
    , height? :
    Dimension
    , min_width? : Double, min_height? : Double, padding_x? : Double, padding_y? : Double) ->
    Component

    Single-line IME-friendly input view

    ime_textarea

    fn ime_textarea(value : String, is_editing : Bool, focused? : Bool, disabled? : Bool, id? : String, rows? : Int, placeholder? : String, fg? :
    Color
    , bg? :
    Color
    , placeholder_fg? :
    Color
    , focus_border_color? :
    Color
    , edit_border_color? :
    Color
    , disabled_fg? :
    Color
    , disabled_bg? :
    Color
    , width? :
    Dimension
    , min_width? : Double, padding_x? : Double, padding_y? : Double) ->
    Component

    Multi-line IME-friendly textarea view

    input

    fn input(value : String, id? : String, placeholder? : String, state? : InputState, fg? :
    Color
    , bg? :
    Color
    , placeholder_fg? :
    Color
    , focus_border_color? :
    Color
    , edit_border_color? :
    Color
    , disabled_fg? :
    Color
    , disabled_bg? :
    Color
    , width? :
    Dimension
    , height? :
    Dimension
    , min_width? : Double, min_height? : Double, padding_x? : Double, padding_y? : Double) ->
    Component

    Create an input component Set height for multi-line wrapping support

    input_plain

    fn input_plain(value : String, placeholder? : String, state? : InputState, fg? :
    Color
    , bg? :
    Color
    , placeholder_fg? :
    Color
    , underline? : Bool) ->
    Component

    Create an input field without border

    labeled_block

    fn labeled_block(icon : String, label : String, content : String, label_color? :
    Color
    , content_color? :
    Color
    , bold_label? : Bool, width? : Int, height? : Int, indent? : String) ->
    Component

    Create a labeled block with icon, label, and content icon: single character icon (e.g., "◆", "✦", "◇") label: text label (e.g., "You", "Assistant") content: the main content text label_color: color for icon and label content_color: color for content text width: component width height: optional fixed height indent: content indentation (default: " ")

    labeled_block_assistant_color

    fn labeled_block_assistant_color() ->
    Color

    labeled_block_error_color

    fn labeled_block_error_color() ->
    Color

    labeled_block_pending_color

    fn labeled_block_pending_color() ->
    Color

    labeled_block_success_color

    fn labeled_block_success_color() ->
    Color

    labeled_block_user_color

    fn labeled_block_user_color() ->
    Color

    Preset colors for common use cases

    labeled_checkbox

    fn labeled_checkbox(label : String, checked : Bool, id? : String, focused? : Bool, disabled? : Bool, label_position? : LabelPosition, theme? : Theme, gap? : Double, on_click? : () -> Unit?) ->
    Component

    Checkbox with label

    labeled_switch

    fn labeled_switch(label : String, on : Bool, id? : String, focused? : Bool, disabled? : Bool, label_position? : LabelPosition, theme? : Theme, gap? : Double, on_click? : () -> Unit?) ->
    Component

    Switch with label

    listbox

    fn listbox(options : Array[ListboxOption], selected_id : String, id? : String, focused_id? : String, orientation? : ListboxOrientation, theme? : Theme, min_width? : Double, max_height? : Int, padding_x? : Double) ->
    Component

    Create a single-select listbox with theme support

    listbox_multi

    fn listbox_multi(options : Array[ListboxOption], state : ListboxState, id? : String, orientation? : ListboxOrientation, theme? : Theme, min_width? : Double, max_height? : Int, padding_x? : Double) ->
    Component

    Create a multi-select listbox with theme support

    listbox_option

    fn listbox_option(id : String, label : String, disabled? : Bool) -> ListboxOption

    Create a listbox option

    loading_dots

    fn loading_dots(tick : Int, label? : String, theme? : Theme) ->
    Component

    Loading indicator with dots animation and theme support
    fn menu(items : Array[MenuItem], focused_id? : String, id? : String, theme? : Theme, min_width? : Double) ->
    Component

    Simple menu (dropdown menu without menubar) with theme support
    fn menu_checkbox(id : String, label : String, checked : Bool, disabled? : Bool) -> MenuItem

    Create a checkbox menu item
    fn menu_item(id : String, label : String, disabled? : Bool) -> MenuItem

    Create a menu item
    fn menu_radio(id : String, label : String, selected : Bool, disabled? : Bool) -> MenuItem

    Create a radio menu item
    fn menu_separator() -> MenuItem

    Create a separator
    fn menu_submenu(id : String, label : String, items : Array[MenuItem], disabled? : Bool) -> MenuItem

    Create a submenu item
    fn menubar(items : Array[MenubarItem], state : MenubarState, id? : String, theme? : Theme, item_padding_x? : Double, dropdown_min_width? : Double) ->
    Component

    Create a menubar component with theme support

    Create a modal container that centers its content The modal takes full screen and centers the content within it

    Create a modal with backdrop overlay This is the most common usage - a semi-transparent backdrop with centered modal

    multiline_input

    fn multiline_input(value : String, id? : String, rows? : Int, placeholder? : String, state? : TextareaState, fg? :
    Color
    , bg? :
    Color
    , placeholder_fg? :
    Color
    , focus_border_color? :
    Color
    , edit_border_color? :
    Color
    , disabled_fg? :
    Color
    , disabled_bg? :
    Color
    , width? :
    Dimension
    , min_width? : Double, padding_x? : Double, padding_y? : Double) ->
    Component

    Create a multiline input component that wraps text within its bounds.

    option_list

    fn option_list(options : Array[ListboxOption], selected_ids : Array[String], focused_id? : String, multiselectable? : Bool, theme? : Theme) ->
    Component

    Simple option list without border (for embedding)

    padded

    Box with padding

    panel

    Panel - single border without padding, for grouping content

    percent_text

    fn percent_text(ratio : Double, theme? : Theme) ->
    Component

    Simple percentage text with theme support

    progress_bar

    fn progress_bar(ratio : Double, width : Int, style? : ProgressStyle, show_percent? : Bool, theme? : Theme) ->
    Component

    Progress bar component with theme support

    radio

    fn radio(label : String, selected : Bool, id? : String, focused? : Bool, theme? : Theme, selected_icon? : String, unselected_icon? : String, gap? : Double) ->
    Component

    Single radio button

    radiogroup

    fn radiogroup(options : Array[RadioOption], selected_id : String, id? : String, focused_id? : String, orientation? : RadioOrientation, theme? : Theme, selected_icon? : String, unselected_icon? : String, gap? : Double, item_gap? : Double) ->
    Component

    Create a radio group component with theme support

    resizable_pane

    fn resizable_pane(primary :
    Component
    , secondary :
    Component
    , position : Int, orientation? : SplitterOrientation, id? : String, focused? : Bool, show_position? : Bool, total_size? : Int) ->
    Component

    Resizable pane with visible position indicator

    row

    fn row(children : Array[
    Component
    ], id? : String, width? :
    Dimension
    , height? :
    Dimension
    , min_width? :
    Dimension
    , min_height? :
    Dimension
    , max_width? :
    Dimension
    , max_height? :
    Dimension
    , flex_grow? : Double, flex_shrink? : Double, flex_basis? :
    Dimension
    , justify? :
    Alignment
    , align? :
    Alignment
    , wrap? : Bool, gap? : Double, padding? : Double, padding_x? : Double, padding_y? : Double, margin? : Double, margin_x? : Double, margin_y? : Double, border? :
    BorderChars
    ?, border_color? :
    Color
    , bg? :
    Color
    , fg? :
    Color
    , on_click? : () -> Unit?, role? :
    Role
    ?) ->
    Component

    Create a horizontal row container

    scroll_indicator

    Scroll indicator component

    scroll_indicator_text

    fn scroll_indicator_text(indicator : ScrollIndicator) -> String

    Get scroll indicator text

    scrollable_list

    fn scrollable_list(items : Array[
    Component
    ], state : ScrollState, visible_height : Int, show_indicator? : Bool, indicator_fg? :
    Color
    ) -> Array[
    Component
    ]

    Scrollable list component items: array of components to display state: scroll state visible_height: number of visible lines show_indicator: whether to show scroll indicator

    scrollbar

    fn scrollbar(offset : Int, total_items : Int, visible_count : Int, height : Int, track_color? :
    Color
    , thumb_color? :
    Color
    , track_char? : String, thumb_char? : String) ->
    Component

    Scrollbar component - renders a vertical scrollbar as a text_box Note: track_color is kept for API compatibility but text_box uses single color

    select

    fn select(options : Array[ComboboxOption], selected_id : String, id? : String, focused_id? : String, open? : Bool, placeholder? : String, theme? : Theme, min_width? : Double, max_visible? : Int) ->
    Component

    Simple select dropdown (no text input) with theme support

    selectable_list

    fn selectable_list(items_data : Array[(String, String)], selected_id : String, focused_id? : String, theme? : Theme) ->
    Component

    Inline selectable list (no box styling)

    simple_editor

    Simple editor (without undo/redo)

    snapshot

    fn snapshot(_app : HeadlessApp, _name : String) -> Unit

    Snapshot testing helper (simplified)

    spacer

    fn spacer(flex_grow? : Double) ->
    Component

    Flexible spacer

    spinner

    fn spinner(tick : Int, label? : String, theme? : Theme) ->
    Component

    Spinner component with theme support (use with ticker for animation)

    split_lines

    fn split_lines(text : String) -> Array[String]

    Split string by newlines (useful for multi-line streaming content)

    splitter_handle

    fn splitter_handle(orientation : SplitterOrientation, focused? : Bool, id? : String, fg? :
    Color
    , bg? :
    Color
    , focused_fg? :
    Color
    , focused_bg? :
    Color
    ) ->
    Component

    Interactive divider handle (standalone)

    start_edit

    fn start_edit(config : EditConfig, current_value : String, on_complete : () -> Unit, confirm_on_shift_enter? : Bool, esc_cancels? : Bool) -> Unit

    Start editing a field with cooked mode (IME support) This exits alternate screen temporarily for proper IME input confirm_on_shift_enter: if true, Shift+Enter confirms and Enter inserts newline esc_cancels: if false, Esc is ignored

    start_edit_inplace

    fn start_edit_inplace(config : EditConfig, current_value : String, row : Int, col : Int, width : Int, height : Int, multiline : Bool, on_complete : () -> Unit, confirm_on_shift_enter? : Bool, esc_cancels? : Bool, on_lines_change? : (Int) -> Int?, on_completion? : (String, Int) -> String??) -> Unit

    Start editing a field inplace (stays in TUI screen) row/col are 1-indexed ANSI coordinates width/height define the input area (supports multi-line wrapping) multiline: if true, Enter can insert newline when confirm_on_shift_enter is true confirm_on_shift_enter: if true, Shift+Enter confirms esc_cancels: if false, Esc is ignored on_lines_change: optional callback (line_count) -> new_height for dynamic resizing on_completion: optional callback (text, cursor_pos) -> completion_suffix for Tab completion

    start_edit_inplace_in_bounds

    fn start_edit_inplace_in_bounds(config : EditConfig, current_value : String, bounds :
    HitTestResult
    , multiline : Bool, on_complete : () -> Unit, confirm_on_shift_enter? : Bool, esc_cancels? : Bool, border? : Int, on_lines_change? : (Int) -> Int?, on_completion? : (String, Int) -> String??) -> Unit

    Start editing within bounds (HitTestResult) with border adjustment. bounds.x/y are 0-indexed; row/col for ANSI are 1-indexed. on_completion: optional callback (text, cursor_pos) -> completion_suffix for Tab completion

    streaming_block

    fn streaming_block(icon : String, label : String, content : String, is_streaming? : Bool, label_color? :
    Color
    , content_color? :
    Color
    , bold_label? : Bool, width? : Int, height? : Int, indent? : String, cursor_char? : String) ->
    Component

    Create a labeled streaming text block (combines labeled_block with streaming_text) icon: single character icon label: text label content: current streamed content is_streaming: whether streaming is active label_color: color for icon and label content_color: color for content text width: component width height: optional fixed height for the entire block indent: content indentation cursor_char: character to show as cursor

    streaming_text

    fn streaming_text(content : String, is_streaming? : Bool, cursor_char? : String, fg? :
    Color
    , width? : Int, height? : Int) ->
    Component

    Create a streaming text display with cursor indicator content: current streamed content is_streaming: whether streaming is active (shows cursor) cursor_char: character to show as cursor (default: "▌") fg: text color width: component width height: optional fixed height

    switch

    fn switch(on : Bool, id? : String, focused? : Bool, disabled? : Bool, theme? : Theme, track_on? : String, track_off? : String, on_click? : () -> Unit?) ->
    Component

    Create a switch component with theme support

    tab_container

    fn tab_container(items : Array[TabItem], selected_id : String, content :
    Component
    , id? : String, focused_id? : String, theme? : Theme, padding_x? : Double) ->
    Component

    Integrated tab container - tabs with border, content panel below Visual design: active tab connects to content panel ╭──────╮ │ Home │ Profile Settings ╰──┬───╯ ╭───┴─────────────────────────╮ │ Content here │ ╰─────────────────────────────╯

    tab_panel

    fn tab_panel(content :
    Component
    , id? : String, theme? : Theme, border? :
    BorderChars
    ?, padding? : Double) ->
    Component

    Create a tab panel container

    tabs

    fn tabs(items : Array[TabItem], selected_id : String, id? : String, focused_id? : String, theme? : Theme, padding_x? : Double) ->
    Component

    Create a simple tab bar (no content)

    tabs_boxed

    fn tabs_boxed(items : Array[TabItem], selected_id : String, id? : String, focused_id? : String, theme? : Theme, padding_x? : Double) ->
    Component

    Tab bar with boxed style (each tab has its own border) Visual: active tabs have bold text and colored border

    tabs_underline

    fn tabs_underline(items : Array[TabItem], selected_id : String, id? : String, focused_id? : String, theme? : Theme, padding_x? : Double) ->
    Component

    Tab bar with underline style Visual: active tabs have bold text and thick underline (━)

    text

    fn text(content : String, fg? :
    Color
    , bg? :
    Color
    , bold? : Bool, underline? : Bool) ->
    Component

    Text component

    text_button

    fn text_button(label : String, state? : ButtonState, theme? : Theme, underline? : Bool) ->
    Component

    Simple text button (no border)

    textarea

    fn textarea(value : String, id? : String, rows? : Int, placeholder? : String, state? : TextareaState, fg? :
    Color
    , bg? :
    Color
    , placeholder_fg? :
    Color
    , focus_border_color? :
    Color
    , edit_border_color? :
    Color
    , disabled_fg? :
    Color
    , disabled_bg? :
    Color
    , width? :
    Dimension
    , min_width? : Double, padding_x? : Double, padding_y? : Double) ->
    Component

    Create a textarea component

    title_bar

    Title bar - centered bold text with margin

    truncate_text

    fn truncate_text(s : String, width : Int) -> String

    Truncate string to given width

    vdivider

    Vertical divider line (1 column width, fills height)

    vspace

    fn vspace(height : Double) ->
    Component

    Fixed-height vertical spacer

    vsplit

    fn vsplit(left : Array[
    Component
    ], right : Array[
    Component
    ], total_width : Int, left_size : SplitSize, right_size : SplitSize, divider? :
    Component
    ?, divider_size? : Int) ->
    Component

    Vertical split pane (left and right)

    vsplit_fixed_left

    Simple vertical split with fixed left width

    vsplit_fixed_right

    fn vsplit_fixed_right(left : Array[
    Component
    ], right : Array[
    Component
    ], total_width : Int, right_width : Int, divider? :
    Component
    ?) ->
    Component

    Simple vertical split with fixed right width

    window_splitter

    fn window_splitter(primary :
    Component
    , secondary :
    Component
    , state : SplitterState, orientation? : SplitterOrientation, id? : String, min? : Int, max? : Int, divider_fg? :
    Color
    , divider_bg? :
    Color
    , focused_fg? :
    Color
    , focused_bg? :
    Color
    , total_size? : Int, divider_width? : Double) ->
    Component

    Create a window splitter with draggable divider

    with_modal

    Helper to conditionally render a modal overlay on top of base content Returns the base content with modal overlaid if modal is open

    wrap_text

    fn wrap_text(text : String, width : Int) -> Array[String]

    Wrap text to fit within width, handling newlines