Crate rat_widget

Source
Expand description

semver stable 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

Modules§

button
Button widget.
calendar
Calendar widgets.
checkbox
Checkbox widget.
choice
Choice/Select widget.
clipper
An alternative view widget.
date_input
Date input with patterns from chrono. See also rat-text
event
Event-handler traits and Keybindings.
file_dialog
File dialog.
focus
Module for focus-handling functionality. See rat-focus
hover
layout
Layout calculations apart from ratatui/Layout.
line_number
Line numbers widget. For use with TextArea mostly.
list
Extensions for ratatui List.
menu
Menu widgets. See also rat-menu
msgdialog
A message dialog.
number_input
Number input with a number pattern. See rat-text
pager
Alternative to scrolling by page-breaking a layout.
paired
Render two widgets in one area.
paragraph
Extensions for ratatui Paragraph.
popup
PopupCore helps with managing popup widgets. See also rat-popup
radio
range_op
Bounded numeric operations.
reloc
Trait for relocatable widgets. See also rat-reloc
scrolled
Scroll attribute and event-handling. See rat-scrolled
shadow
Draw a shadow around a widget.
slider
Slider widget.
splitter
Vertical and horizontal multiple split.
statusline
Statusbar with multiple sections.
tabbed
Tabs.
table
Table widget.
text
Text editing core functionality and utilities.
text_input
Text-Input widget. See rat-text
text_input_mask
Text-Input with pattern/mask. See rat-text
textarea
Text-Area. See rat-text
util
Small helpers.
view
A view allows scrolling of on or more widgets without builtin support for scrolling.