ratatui/
prelude.rs

1//! A prelude for conveniently writing applications using this library.
2//!
3//! The prelude module is no longer used universally in Ratatui, as it can make it harder to
4//! distinguish between library and non-library types, especially when viewing source code
5//! outside of an IDE (such as on GitHub or in a git diff). For more details and user feedback,
6//! see [Issue #1150]. However, the prelude is still available for backward compatibility and for
7//! those who prefer to use it.
8//!
9//! [Issue #1150]: https://github.com/ratatui/ratatui/issues/1150
10//!
11//! # Examples
12//!
13//! ```rust,no_run
14//! use ratatui::prelude::*;
15//! ```
16//!
17//! Aside from the main types that are used in the library, this prelude also re-exports several
18//! modules to make it easy to qualify types that would otherwise collide. E.g.:
19//!
20//! ```rust
21//! use ratatui::{prelude::*, widgets::*};
22//!
23//! #[derive(Debug, Default, PartialEq, Eq)]
24//! struct Line;
25//!
26//! assert_eq!(Line::default(), Line);
27//! assert_eq!(text::Line::default(), ratatui::text::Line::from(vec![]));
28//! ```
29
30#[cfg(feature = "crossterm")]
31pub use crate::backend::CrosstermBackend;
32#[cfg(all(not(windows), feature = "termion"))]
33pub use crate::backend::TermionBackend;
34#[cfg(feature = "termwiz")]
35pub use crate::backend::TermwizBackend;
36pub use crate::{
37    backend::{self, Backend},
38    buffer::{self, Buffer},
39    layout::{self, Alignment, Constraint, Direction, Layout, Margin, Position, Rect, Size},
40    style::{self, Color, Modifier, Style, Stylize},
41    symbols::{self},
42    text::{self, Line, Masked, Span, Text},
43    widgets::{block::BlockExt, StatefulWidget, Widget},
44    Frame, Terminal,
45};