mirror of
https://github.com/ratatui-org/ratatui
synced 2024-11-22 04:33:13 +00:00
docs(paragraph): add docs for alignment fn (#467)
This commit is contained in:
parent
343c6cdc47
commit
080a05bbd3
1 changed files with 14 additions and 0 deletions
|
@ -196,6 +196,20 @@ impl<'a> Paragraph<'a> {
|
|||
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> {
|
||||
self.alignment = alignment;
|
||||
self
|
||||
|
|
Loading…
Reference in a new issue