tui-popup
A popup widget for Ratatui
The popup widget is a simple widget that renders a popup in the center of the screen.
Example
use *;
use Popup;
State
The widget supports storing the position of the popup in PopupState. This is experimental and the exact api for this will likely change.
use *;
use Popup;
The popup can automatically handle being moved around by the mouse, by passing in the column and row of Mouse Up / Down / Drag events. The current implemntation of this checks whether the click is in the first row of the popup, otherwise ignores the event.
match event.read?
The popup also supports rendering arbitrary widgets by implementing SizedWidgetRef (or wrapping them
with the provided SizedWrapper). This makes it possible to support wrapping and scrolling in using a
Paragraph
widget, or scrolling any amount of widgets using
tui-scrollview.
let lines: Text = .map.collect;
let paragraph = new.scroll;
let sized_paragraph = SizedWrapper ;
let popup = new
.style;
frame.render_widget_ref;
Features
- automatically centers
- automatically sizes to content
- style popup
- move the popup (using state)
- handle mouse events for dragging
- move to position
- resize
- set border set / style
- add close button
- add nicer styling of header etc.
- configure text wrapping in body to conform to a specific size