Expand description
A mouse-first data grid for Ratatui.
Render Grid::widget each frame, then pass focused keyboard events and mouse
events to Grid::handle_event. Rendering and hit-testing share one layout.
The application owns terminal setup, component focus, fetching, persistence, and animation timing. Owned datasets sort globally; external grids request one source-sorted page at a time.
use ratagrid::{Column, Grid};
let columns = vec![Column::new("Value", 12, |n: &u64| n.to_string())
.sortable(|a, b| a.cmp(b))];
let mut grid = Grid::new(columns, vec![100, 2, 10]);
// In your draw callback: frame.render_widget(grid.widget(), area);
// In your focused event loop: grid.handle_event(&event);See the bundled feature guide, pagination guide, and updates guide.
Modules§
- guides
- Integration guides bundled with the crate, independent of repository access.
Structs§
- Cell
Detail - The complete, printable value currently shown in a detail panel.
- Cell
Details Options - Opt-in full-value panels for truncated data cells.
- Column
- A typed column. Sorting compares records, independently of their display text.
- Column
Order Error - Invalid column order. Supply each original column index exactly once.
- Cursor
Page Request - A cursor request. Capture this value and the search query before dispatching asynchronous work; return the original request with its response.
- External
Filter Error - Typed predicates cannot be executed against records held by an external source.
- Grid
- Interactive grid state plus its framework-independent model.
- Grid
Model - Framework-independent ordering and selection over owned records.
- Grid
Style - Colors for the grid. Replace these to match your application’s theme.
- Grid
Widget - A widget borrowing the grid, updating its hit-test geometry while rendering.
- Page
Request - A page/sort request. Keep this value with an asynchronous request and return it
unchanged to
crate::Grid::set_page_datato reject stale responses. - Page
State - Read-only pagination metadata. Empty datasets have one empty page.
- Sort
- Single-column sort state.
Nonerestores insertion order.
Enums§
- Action
- Changes emitted by grid interaction. Row indices refer to insertion order.
- Copy
Target - What to format for an application-owned clipboard operation.
- Load
State - Current display state. Errors belong to the current external request only.
- Page
Error - A page response was not accepted. Failed responses leave the current grid unchanged.
- Pagination
Mode - Who owns the full dataset and performs sorting.
- Sort
Direction - The direction of an active sort.