mirror of
https://github.com/ratatui/ratatui.git
synced 2025-10-02 07:21:24 +00:00
docs(paragraph): add docs for alignment fn (#467)
This commit is contained in:
parent
343c6cdc47
commit
080a05bbd3
@ -196,6 +196,20 @@ impl<'a> Paragraph<'a> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Set the text alignment for the given paragraph
|
||||||
|
///
|
||||||
|
/// The alignment is a variant of the [`Alignment`] enum which can be one of Left, Right, or
|
||||||
|
/// Center.
|
||||||
|
///
|
||||||
|
/// # Example
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// # use ratatui::prelude::*;
|
||||||
|
/// # use ratatui::widgets::{Paragraph, Wrap};
|
||||||
|
/// # use ratatui::layout::Alignment;
|
||||||
|
/// let paragraph = Paragraph::new("Hello World")
|
||||||
|
/// .alignment(Alignment::Center);
|
||||||
|
/// ```
|
||||||
pub fn alignment(mut self, alignment: Alignment) -> Paragraph<'a> {
|
pub fn alignment(mut self, alignment: Alignment) -> Paragraph<'a> {
|
||||||
self.alignment = alignment;
|
self.alignment = alignment;
|
||||||
self
|
self
|
||||||
|
Loading…
x
Reference in New Issue
Block a user