rat-widget 0.14.0

ratatui widgets extended edition
Documentation

!! this is out of date !!

crates.io Documentation License License

Rat-Widget

This crate tries to provide an extended set of widgets with

  • Event handling
  • Focus handling
  • Scrolling
  • Speed

Event handling

Uses the trait defined in rat-event to implement event-handling for crossterm. All widgets are designed with other event-handlers in mind. They provide single entry-functions that map 1:1 with events most of the time.

Focus handling

Uses FocusFlag defined by rat-focus internally, to mark the focused widget.

This is just a passive flag, that probably can be used with other focus systems. Or you use rat-focus, it is independent of any frameworks and works by collecting references to the FocusFlags that are part of the focus and navigating with this information.

Scrolling

Where it makes sense the widgets implement an internal offset for scrolling. They can display the scrollbar themselves by using Scroll from rat-scrolled. This is a utility that works much like the ratatui Block and can be plugged into the widget.

Speed

Rendering all the widgets tries hard not to need allocations and extensive copying of the underlying data.

Special mention here are rat_ftable::Table, which uses an adapter for the data instead of creating Row/Cell structs. The adapter is only called for the visible cells when rendering. This way there is no real limit to the size of your data. Anything that can provide a slice look-alike or an iterator is fine.

Second special mention is rat_widget::TextArea which uses Ropey for the underlying storage. It also has range based styling builtin.

Rat-Salsa

This crate is part of rat-salsa.

Widgets

All the widgets are plain ratatui widgets, and implement StatefulWidget and the (experimental) StatefulWidgetRef traits.

Event handling uses rat-event::HandleEvent for uniformity, but provide plain functions too. Currently, crossterm events are implemented.

and some adapters for ratatui widgets