Components Reference
Interactive terminal components API reference
Components Reference
[dependencies]
xacli = { version = "0.2.1", features = ["components"] }
use xacli::components::*;
Input
Text input with optional default value.
let value = Input::new("Prompt:")
.default("default value")
.run()?;
| Method | Description |
|---|---|
new(prompt) | Create input |
default(value) | Set default |
run() | Execute, returns Result<String> |
Confirm
Yes/No confirmation dialog.
let yes = Confirm::new("Continue?")
.default(true)
.run()?;
| Method | Description |
|---|---|
new(prompt) | Create confirm |
default(bool) | Set default selection |
run() | Execute, returns Result<bool> |
Select
Single selection from options.
let choice = Select::new("Choose:")
.option("Label", "value")
.run()?;
| Method | Description |
|---|---|
new(prompt) | Create select |
option(label, value) | Add option |
run() | Execute, returns Result<String> |
MultiSelect
Multiple selection from options.
let choices = MultiSelect::new("Select:")
.option("Label", "value")
.run()?;
| Method | Description |
|---|---|
new(prompt) | Create multiselect |
option(label, value) | Add option |
run() | Execute, returns Result<Vec<String>> |
ProgressBar
Progress indicator for known-length operations.
let (bar, handle) = ProgressBar::new(total, "Message");
handle.inc(1); // Increment
handle.set(50); // Set value
handle.finish(); // Complete
bar.run()?;
Spinner
Loading indicator for unknown-length operations.
let spinner = Spinner::new("Loading...")
.frames(spinner::frames::dots())
.run()?;
spinner.stop();
| Frames | Description |
|---|---|
dots() | Dot animation |
line() | Line animation |
arc() | Arc animation |