Skip to main content

Crate rat_widget

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 to render the scroll bars.

§Speed

When rendering all the widgets try hard to do so without allocations and extensive copying.

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.

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.

See rat-reloc

§Extras

A collections of uncommon widgets

rat-widget-extra

Modules§

button
Button widget.
calendar
Calendar widgets.
checkbox
Checkbox widget.
choice
Choice/Select widget.
clipper
Alternative View widget that renders only visible widgets.
combobox
date_input
Date input with patterns from chrono.
dialog_frame
A simple dialog frame and buttons.
event
Event-handler traits and Keybindings.
file_dialog
File dialog.
focus
Module for focus-handling functionality. See rat-focus
form
Render widgets based on a GenericLayout.
hover
layout
Layout calculations apart from ratatui/Layout.
line_number
Line numbers widget.
list
A list widget.
menu
Menu widgets. See also rat-menu
msgdialog
A message dialog.
number_input
Number input with a number pattern.
paired
Render two widgets in one area.
paragraph
Extensions for ratatui Paragraph.
popup
PopupCore helps managing popup widgets.
radio
Radiobutton widget.
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 or horizontal multiple split.
statusline
Statusbar with multiple sections.
statusline_stacked
A status-line widget that can stack up indicators on the left and right end.
tabbed
Render tabs.
table
Table widget.
table2
Evolution of the table widget.
text
Text editing core functionality and utilities.
text_input
Text-Input widget.
text_input_mask
Text-Input with pattern/mask.
textarea
Text-Area.
toolbar
EXPERIMENTAL Toolbar with Buttons, Checkbox and Choices.
util
Small helpers.
view
A view allows scrolling of on or more widgets without builtin support for scrolling.