Skip to content

Commit

Permalink
docs(paragraph): add docs for alignment fn (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
DreadedHippy authored and joshka committed Sep 5, 2023
1 parent 343c6cd commit 080a05b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/widgets/paragraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 080a05b

Please sign in to comment.