You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use envision::prelude::*;use ratatui::widgets::Paragraph;// Given the MyApp defined above:#[test]fntest_my_app(){letmut runtime = Runtime::<MyApp>::virtual_terminal(80,24).unwrap();
runtime.dispatch(Msg::Increment);
runtime.dispatch(Msg::Increment);
runtime.render().unwrap();assert!(runtime.contains_text("Count: 2"));}
# Basic capture backend usage
cargo run --example capture_backend
# TEA architecture with sync runtime
cargo run --example counter_app
# Async runtime with subscriptions
cargo run --example async_counter
# Test harness and assertions
cargo run --example test_harness
# Widget annotations
cargo run --example annotations
# Theme switching with components
cargo run --example themed_app
# Multi-component showcase with focus management
cargo run --example component_showcase
Components
Envision provides a comprehensive library of 42 reusable UI components, all following the TEA (The Elm Architecture) pattern with Component, Focusable, Disableable, and Toggleable traits.
Input Components
Component
Description
Button
Clickable button with keyboard activation
Checkbox
Toggleable checkbox with label
Dropdown
Searchable/filterable select with type-to-filter
InputField
Single-line text input with cursor navigation
LineInput
Single-line input with visual wrapping, history, undo/redo
RadioGroup
Single-selection radio button group
Select
Dropdown selection widget
TextArea
Multi-line text editor with scrolling
Display Components
Component
Description
KeyHints
Keyboard shortcut display bar
MultiProgress
Concurrent progress indicators for batch operations
ProgressBar
Visual progress indicator with percentage
ScrollableText
Scrollable read-only text display with CJK support
Spinner
Animated loading indicator (multiple styles)
StatusBar
Application status bar with sections, timers, counters
StatusLog
Scrolling status messages with severity levels
StepIndicator
Multi-step workflow progress display
StyledText
Rich text display with inline styling
TitleCard
Centered title display with subtitle and prefix/suffix
Toast
Non-modal notification system with auto-dismiss
Tooltip
Contextual information overlay
Navigation Components
Component
Description
Accordion
Collapsible panel container
Breadcrumb
Navigation breadcrumb trail
Menu
Keyboard-navigable menu with shortcuts
Router
Multi-screen navigation with history
Tabs
Horizontal tab navigation
Tree
Hierarchical tree view with expand/collapse
Data Components
Component
Description
Table
Data table with sorting and selection
SelectableList
Scrollable list with keyboard navigation
LoadingList
List with per-item loading and error states
Overlay Components
Component
Description
ConfirmDialog
Preset confirmation dialog with Yes/No buttons
Dialog
Modal dialog overlay with buttons
Compound Components
Component
Description
ChatView
Chat interface with message history and markdown rendering
Chart
Data visualization with line and bar charts
DataGrid
Editable data table with cell navigation
FileBrowser
File system browser with pluggable backend
Form
Multi-field form with validation
LogViewer
Filterable log display with search
MetricsDashboard
Dashboard with charts, counters, and gauges
PaneLayout
Resizable split-pane layouts with configurable proportions
SearchableList
Filterable list with search input
SplitPanel
Resizable dual-panel layout
Utility
Component
Description
FocusManager
Keyboard focus coordination
Component Example
use envision::component::{Button,ButtonMessage,ButtonState,Component,Focusable};// Initialize stateletmut state = ButtonState::new("Submit");// Handle messagesButton::update(&mut state,ButtonMessage::Press);// Focus managementButton::set_focused(&mut state,true);assert!(Button::is_focused(&state));
Architecture
Envision follows The Elm Architecture (TEA) pattern: