[go: up one dir, main page]

tui-scrollview 0.1.1

A simple scrollable view for Ratatui
Documentation

Tui-scrollview

License Badge Docs.rs Badge Deps.rs Badge Codecov.io Badge Discord Badge

tui-scrollview is a library for creating scrollable views in [Ratatui].

Installation

cargo add tui-scrollview

Usage

use tui_scrollview::ScrollView;
use ratatui::{prelude::*, layout::Size};

fn render(Frame: &mut Frame) {
    let size = Size::new(10, 100);
    let mut scroll_view = ScrollView::new(size);
    let some_long_string =
        iter::repeat("Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n")
           .take(100)
           .collect::<String>();
    let area = size.into();
    scroll_view.render_widget(Text::from(some_long_string), area);
    let state = ScrollViewState::default();
    frame.render_stateful_widget(scroll_view, area);
}

License

Copyright (c) 2023 Josh McKinney

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

See CONTRIBUTING.md.