mirror of
https://github.com/ratatui-org/ratatui
synced 2025-02-16 14:08:44 +00:00
docs(table): add documentation for Table::new()
(#471)
This commit is contained in:
parent
c95a75c5d5
commit
232be80325
1 changed files with 21 additions and 0 deletions
|
@ -268,6 +268,27 @@ pub struct Table<'a> {
|
|||
}
|
||||
|
||||
impl<'a> Table<'a> {
|
||||
/// Creates a new [`Table`] widget with the given rows.
|
||||
///
|
||||
/// The `rows` parameter is a Vector of [`Row`], this holds the data to be displayed by the
|
||||
/// table
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// # use ratatui::prelude::*;
|
||||
/// # use ratatui::widgets::{Table, Row, Cell};
|
||||
/// let table = Table::new(vec![
|
||||
/// Row::new(vec![
|
||||
/// Cell::from("Cell1"),
|
||||
/// Cell::from("Cell2")
|
||||
/// ]),
|
||||
/// Row::new(vec![
|
||||
/// Cell::from("Cell3"),
|
||||
/// Cell::from("Cell4")
|
||||
/// ]),
|
||||
/// ]);
|
||||
/// ```
|
||||
pub fn new<T>(rows: T) -> Self
|
||||
where
|
||||
T: IntoIterator<Item = Row<'a>>,
|
||||
|
|
Loading…
Add table
Reference in a new issue