36 releases (6 stable)

new 1.0.5 Feb 10, 2025
1.0.1 Jan 31, 2025
0.37.2 Jan 29, 2025
0.32.0 Dec 29, 2024
0.13.0 Jul 3, 2024

#1030 in Command-line interface

Download history 325/week @ 2024-10-20 146/week @ 2024-10-27 27/week @ 2024-11-03 1/week @ 2024-11-10 8/week @ 2024-11-17 2/week @ 2024-11-24 80/week @ 2024-12-01 320/week @ 2024-12-08 62/week @ 2024-12-15 10/week @ 2024-12-22 402/week @ 2024-12-29 241/week @ 2025-01-05 19/week @ 2025-01-12 125/week @ 2025-01-19 683/week @ 2025-01-26 507/week @ 2025-02-02

1,336 downloads per month
Used in 4 crates

MIT/Apache

1.5MB
38K SLoC

beta 3 crates.io Documentation License License

This crate is a part of rat-salsa.

For examples see rat-widget GitHub

Rat Widgets

This crate tries to provide an extended set of widgets with

  • Event handling
  • Focus handling
  • Builtin 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.

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.

Scrolling

Where it makes sense the widgets implement internal scrolling. They use Scroll from rat-scrolled.

Speed

Rendering all the widgets tries hard not to need allocations and extensive copying during rendering.

Special mentions:

  • rat-ftable::Table: It uses an adapter for the data for rendering instead of creating Row/Cell structs.

Widgets

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

Event handling uses rat-event::HandleEvent. Currently, crossterm events are implemented.

Layout

There are some layout calculators beyond ratatui's Layout.

Relocation

Widgets like View and Clipper move the widget-image after rendering. This breaks any areas stored in the widget-states.

reloc

Dependencies

~10–21MB
~277K SLoC