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![]));
Re-exports§
pub use crate::backend::CrosstermBackend;
pub use crate::backend;
pub use crate::backend::Backend;
pub use crate::buffer;
pub use crate::buffer::Buffer;
pub use crate::layout;
pub use crate::layout::Alignment;
pub use crate::layout::Constraint;
pub use crate::layout::Direction;
pub use crate::layout::Layout;
pub use crate::layout::Margin;
pub use crate::layout::Position;
pub use crate::layout::Rect;
pub use crate::layout::Size;
pub use crate::style;
pub use crate::style::Color;
pub use crate::style::Modifier;
pub use crate::style::Style;
pub use crate::style::Stylize;
pub use crate::symbols;
pub use crate::text;
pub use crate::text::Line;
pub use crate::text::Masked;
pub use crate::text::Span;
pub use crate::text::Text;
pub use crate::widgets::block::BlockExt;
pub use crate::widgets::StatefulWidget;
pub use crate::widgets::Widget;
pub use crate::Frame;
pub use crate::Terminal;