Crate rat_widget

Source
Expand description

Current status: BETA

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.

and some adapters for ratatui widgets

Modules§

  • Button widget.
  • Render a month of a calendar. Can be localized with a chrono::Locale.
  • Checkbox widget.
  • Choice/Select widget.
  • An alternative view widget.
  • Number input with patterns from chrono.
  • Event-handler traits and Keybindings.
  • File dialog
  • Module for focus-handling functionality. For details see rat-focus
  • Some functions that calculate more complicate layouts.
  • Line numbers widget. For use with TextArea mostly.
  • Extensions for ratatui List.
  • Menu widgets.
  • A message dialog.
  • Number input with pattern.
  • If you are tired of scrolling, try paging :)
  • Extensions for ratatui Paragraph.
  • PopupCore helps with managing popup widgets.
  • Bounded numeric operations.
  • Relocatable widgets.
  • Scroll attribute and event-handling.
  • Draw a shadow around a widget.
  • Slider widget.
  • Vertical and horizontal multiple split.
  • Statusbar with multiple sections.
  • Tabs.
  • Table widget.
  • Text editing core functionality and utilities.
  • Text-Input widget
  • Text-Input with pattern/mask.
  • Text-Area.
  • Small helpers.
  • A view allows scrolling of on or more widgets without builtin support for scrolling.