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::*;
22//! use ratatui::widgets::*;
23//!
24//! #[derive(Debug, Default, PartialEq, Eq)]
25//! struct Line;
26//!
27//! assert_eq!(Line::default(), Line);
28//! assert_eq!(text::Line::default(), ratatui::text::Line::from(vec![]));
29//! ```
30
31pub use ratatui_core::backend::{self, Backend};
32#[cfg(feature = "crossterm")]
33pub use ratatui_crossterm::{CrosstermBackend, FromCrossterm, IntoCrossterm};
34
35#[cfg(all(not(windows), feature = "termion"))]
36pub use crate::backend::{FromTermion, IntoTermion, TermionBackend};
37#[cfg(feature = "termwiz")]
38pub use crate::backend::{FromTermwiz, IntoTermwiz, TermwizBackend};
39pub use crate::buffer::{self, Buffer};
40pub use crate::layout::{
41    self, Alignment, Constraint, Direction, HorizontalAlignment, Layout, Margin, Position, Rect,
42    Size, VerticalAlignment,
43};
44pub use crate::style::{self, Color, Modifier, Style, Stylize};
45pub use crate::text::{self, Line, Masked, Span, Text};
46pub use crate::widgets::{BlockExt, StatefulWidget, Widget};
47pub use crate::{Frame, Terminal, symbols};