| Crates.io | tui-slider |
| lib.rs | tui-slider |
| version | 0.2.7 |
| created_at | 2025-11-12 21:20:09.832896+00 |
| updated_at | 2026-01-07 17:56:25.975581+00 |
| description | A simple TUI slider component library for ratatui |
| homepage | |
| repository | https://github.com/sorinirimies/tui-slider |
| max_upload_size | |
| id | 1929991 |
| size | 436,632 |
A highly customizable and configurable slider widget for ratatui that puts you in full control of every visual aspect.
Whether you're building music players, audio mixers, settings panels, or progress indicators, tui-slider adapts to your needs with extensive customization options. Configure colors, symbols, orientations, alignments, borders, and behaviorโall through a clean, intuitive API. From minimalist progress bars to feature-rich interactive sliders, you decide exactly how your UI looks and feels.
Add to your Cargo.toml:
[dependencies]
tui-slider = "0.1"
ratatui = "0.28"
use ratatui::prelude::*;
use tui_slider::{Slider, SliderState, SliderOrientation};
fn main() {
// Create a slider state
let mut state = SliderState::new(50.0, 0.0, 100.0);
// Create and render a slider
let slider = Slider::from_state(&state)
.orientation(SliderOrientation::Horizontal)
.label("Volume")
.show_value(true);
// In your render loop
frame.render_widget(slider, area);
// Update the value
state.set_value(75.0);
}
๐ Examples Source Code โ - View all example implementations
Comprehensive horizontal slider styles organized into two pages:

use tui_slider::{Slider, SliderState, SliderOrientation};
let state = SliderState::new(75.0, 0.0, 100.0);
let slider = Slider::from_state(&state)
.orientation(SliderOrientation::Horizontal)
.filled_symbol("โ")
.empty_symbol("โ")
.handle_symbol("โ")
.show_value(true);
๐ cargo run --example horizontal | ๐ View Source
Use n/PageDown and p/PageUp to navigate between style pages.
Vertical slider orientation with various visual styles, perfect for mixer interfaces.

let slider = Slider::from_state(&state)
.orientation(SliderOrientation::Vertical)
.filled_symbol("โ")
.empty_symbol("โ")
.handle_symbol("โฌ");
๐ cargo run --example vertical | ๐ View Source
Various vertical slider styles optimized for different use cases.

๐ cargo run --example vertical | ๐ View Source
Layout strategies and positioning techniques for vertical sliders.

๐ cargo run --example vertical_positioning | ๐ View Source
Create your own slider styles with custom RGB colors and symbol combinations.

use tui_slider::style::SliderStyle;
let style = SliderStyle::horizontal_thick();
let slider = Slider::from_state(&state)
.filled_symbol(style.filled_symbol)
.filled_color(style.filled_color);
๐ cargo run --example custom | ๐ View Source
Border types, styles, and color theming - including Plain, Rounded, Double, Thick borders with full, segmented, and sides-only variations.

๐ cargo run --example borders | ๐ View Source
Side-by-side comparison of sliders with handles (interactive controls) vs without handles (progress bars). Shows the same sliders in both modes to clearly demonstrate the difference.

๐ cargo run --example handles | ๐ View Source
Use Tab to switch between left (with handles) and right (without handles) sections.
Configurable step intervals for fine or coarse value adjustments.

๐ cargo run --example step_sizes | ๐ View Source
Position slider titles left, center, or right.

๐ cargo run --example title_alignment | ๐ View Source
Control value display positioning for optimal layout.

๐ cargo run --example value_alignment | ๐ View Source
Position horizontal slider bars at the top, center, or bottom of the container.

๐ cargo run --example horizontal_bar_alignment | ๐ View Source
| Example | Category | Description | Demo | Source |
|---|---|---|---|---|
horizontal.rs |
Horizontal | Comprehensive horizontal styles (2 pages: Standard & Specialty) | GIF | Code |
vertical.rs |
Vertical | Various vertical slider styles | GIF | Code |
vertical_positioning.rs |
Vertical | Vertical layout strategies | GIF | Code |
custom_symbols.rs |
Styling | Custom RGB colors and symbols | GIF | Code |
borders.rs |
Styling | Border types, styles, and colors | GIF | Code |
handles.rs |
Interactive | Handle visibility comparison (with/without) | GIF | Code |
step_sizes.rs |
Interactive | Configurable step intervals | GIF | Code |
title_alignment.rs |
Layout | Title positioning options | GIF | Code |
value_alignment.rs |
Layout | Value display positioning | GIF | Code |
horizontal_bar_alignment.rs |
Layout | Horizontal bar vertical positioning (top/center/bottom) | GIF | Code |
Most examples share similar keyboard controls:
Check each example's source code for specific controls and features.
use tui_slider::SliderState;
let mut state = SliderState::new(50.0, 0.0, 100.0);
// Increase/decrease by a step
state.increase(5.0);
state.decrease(5.0);
// Set exact value
state.set_value(75.0);
// Get current value
let current = state.value();
// Get as percentage (0.0 to 1.0)
let percentage = state.percentage();
new(value, min, max) - Create a new sliderfrom_state(&state) - Create from a stateorientation(orientation) - Set horizontal or verticallabel(text) - Set label textshow_value(bool) - Show/hide value displayshow_handle(bool) - Show/hide handlefilled_symbol(symbol) - Set filled bar symbolempty_symbol(symbol) - Set empty bar symbolhandle_symbol(symbol) - Set handle symbolfilled_color(color) - Set filled bar colorempty_color(color) - Set empty bar colorhandle_color(color) - Set handle colorshow_handle(bool) - Show/hide thumb indicatorshow_thumb(bool) - Alias for show_handlevertical_label_position(position) - Set label position for vertical slidersvertical_value_position(position) - Set value position for vertical slidersvertical_value_alignment(alignment) - Set value alignment for vertical slidersblock(block) - Add border blocknew(value, min, max) - Create new state
value() - Get current value
set_value(value) - Set value
increase(step) - Increase by step
decrease(step) - Decrease by step
min() / max() - Get bounds
set_min(min) / set_max(max) - Set bounds
percentage() - Get value as percentage (0.0-1.0)
set_percentage(percentage) - Set from percentage
The library consists of three main components:
This project uses just as a command runner for common development tasks.
Run the interactive setup script to install just and configure your environment:
./scripts/setup-just.sh
This script will:
just command runner (if not already installed)git-cliff for changelog generationIf you prefer manual installation:
# Install just
cargo install just
# Install git-cliff (optional, for changelogs)
cargo install git-cliff
# View available commands
just --list
just build # Build the project
just test # Run tests
just check-all # Run all checks (fmt, clippy, test)
just run # Run horizontal slider example
just examples # Run all examples
just bump <version> # Bump version (runs checks first)
For a complete list of available commands, run just --list or see the justfile.
This project follows the "fail early" pattern for version bumps and releases:
just bump <version> runs all checks (fmt, clippy, test) before bumpingjust release <version> depends on bump, ensuring quality before releaseSee Justfile Best Practices & Patterns for detailed documentation.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
See CHANGELOG.md for a list of changes.