Expand description
A prelude for conveniently writing applications using this library.
The prelude module is no longer used universally in Ratatui, as it can make it harder to distinguish between library and non-library types, especially when viewing source code outside of an IDE (such as on GitHub or in a git diff). For more details and user feedback, see Issue #1150. However, the prelude is still available for backward compatibility and for those who prefer to use it.
§Examples
use ratatui::prelude::*;
Aside from the main types that are used in the library, this prelude also re-exports several modules to make it easy to qualify types that would otherwise collide. E.g.:
use ratatui::{prelude::*, widgets::*};
#[derive(Debug, Default, PartialEq, Eq)]
struct Line;
assert_eq!(Line::default(), Line);
assert_eq!(text::Line::default(), ratatui::text::Line::from(vec![]));
Modules§
- This module provides the backend implementations for different terminal libraries.
- Provides types and traits for working with layout and positioning in the terminal.
style
contains the primitives used to control how your user interface will look.- Symbols and markers for drawing various widgets.
- Primitives for styled text.
Structs§
- A buffer that maps to the desired content of the terminal after the draw call
- Crossterm
Backend crossterm
- A consistent view into the terminal state for rendering a single frame.
- A layout is a set of constraints that can be applied to a given area to split it into smaller ones.
- A line of text, consisting of one or more
Span
s. - A wrapper around a string that is masked when displayed.
- Modifier changes the way a piece of text is displayed.
- Position in the terminal
- A Rectangular area.
- A simple size struct
- Represents a part of a line that is contiguous and where all characters share the same style.
- Style lets you control the main characteristics of the displayed elements.
- An interface to interact and draw
Frame
s on the user’s terminal. - Termion
Backend Non-Windows and termion
- Termwiz
Backend termwiz
- A string split over one or more lines.
Enums§
- ANSI Color
- A constraint that defines the size of a layout element.
Traits§
- The
Backend
trait provides an abstraction over different terminal libraries. It defines the methods required to draw content, manipulate the cursor, and clear the terminal screen. - An extension trait for
Block
that provides some convenience methods. - From
Crossterm crossterm
A trait for converting a Crossterm type to a Ratatui type. - From
Termion Non-Windows and termion
A trait for converting a Termion type to a Ratatui type. - From
Termwiz termwiz
A trait for converting types from Termwiz to Ratatui. - Into
Crossterm crossterm
A trait for converting a Ratatui type to a Crossterm type. - Into
Termion Non-Windows and termion
A trait for converting a Ratatui type to a Termion type. - Into
Termwiz termwiz
A trait for converting types from Ratatui to Termwiz. - A
StatefulWidget
is a widget that can take advantage of some local state to remember things between two draw calls. - An extension trait for styling objects.