Crate rat_widget
source ·Expand description
!! this is out of date !!
§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.
- Button
- Calendar
- DateInput (using chrono)
- EditList
- EditTable
- FileDialog
- TextInput
- MaskedInput
- Menubar
- MenuLine
- MsgDialog
- NumberInput (using format_num_pattern)
- PopupMenu
- Split
- StatusLine
- Table
- TextArea
- View
- Viewport
and some adapters for ratatui widgets
Modules§
- A nice Button widget.
- Render a month of a calendar. Can be localized with a chrono::Locale.
- Date-input using chrono
- Event-handler traits and Keybindings.
- File dialog
- Clears an area with a Style and a fill char.
- Module for focus-handling functionality. For details see rat-focus
- Text input.
- Some functions that calculate more complicate layouts.
- Extensions for ratatui List.
- Text input with an input mask.
- A menubar with sub-menus.
- A simple line menu.
- A message dialog.
- Number input
- Extensions for ratatui Paragraph.
- A popup-menu.
- Scroll attribute and event-handling.
- Vertical and horizontal multiple split.
- Statusbar with multiple sections.
- F-Table
- Text editing core functionality and utilities.
- A text-area with text-styling abilities.
- A viewport allows scrolling of a
StatefulWidget
without builtin support for scrolling.
Enums§
- Locales matching the locales in
glibc
.