Skip to main content

TableProps

Struct TableProps 

Source
pub struct TableProps {
Show 18 fields pub header: Option<Row>, pub rows: Vec<Row>, pub widths: Vec<ColumnWidth>, pub column_aligns: Vec<CellAlign>, pub border_style: BorderStyle, pub border_color: Option<Color>, pub column_spacing: u16, pub header_color: Option<Color>, pub header_bg_color: Option<Color>, pub header_bold: bool, pub row_style: RowStyle, pub stripe_color: Option<Color>, pub selected: Option<usize>, pub selected_color: Option<Color>, pub selected_bg_color: Option<Color>, pub row_dividers: bool, pub width: Option<u16>, pub bg_color: Option<Color>,
}
Expand description

Properties for the Table component.

Fields§

§header: Option<Row>

Optional header row.

§rows: Vec<Row>

Data rows.

§widths: Vec<ColumnWidth>

Column widths.

§column_aligns: Vec<CellAlign>

Default column alignment.

§border_style: BorderStyle

Border style around the table.

§border_color: Option<Color>

Border color.

§column_spacing: u16

Spacing between columns.

§header_color: Option<Color>

Header text color.

§header_bg_color: Option<Color>

Header background color.

§header_bold: bool

Whether header is bold.

§row_style: RowStyle

Row styling (e.g., striped).

§stripe_color: Option<Color>

Color for odd rows (when striped).

§selected: Option<usize>

Currently selected row index (for highlighting).

§selected_color: Option<Color>

Selected row highlight color.

§selected_bg_color: Option<Color>

Selected row background color.

§row_dividers: bool

Show row dividers.

§width: Option<u16>

Total table width (optional, for percentage calculations).

§bg_color: Option<Color>

Background color for all cells (lowest priority).

Implementations§

Source§

impl TableProps

Source

pub fn new<I, R>(rows: I) -> Self
where I: IntoIterator<Item = R>, R: Into<Row>,

Create a new table with rows.

Source

pub fn header<R: Into<Row>>(self, header: R) -> Self

Set the header row.

Source

pub fn widths<I: IntoIterator<Item = ColumnWidth>>(self, widths: I) -> Self

Set column widths.

Source

pub fn fixed_widths<I: IntoIterator<Item = u16>>(self, widths: I) -> Self

Set all columns to fixed width.

Source

pub fn column_aligns<I: IntoIterator<Item = CellAlign>>(self, aligns: I) -> Self

Set column alignments.

Source

pub fn border(self, style: BorderStyle) -> Self

Set border style.

Source

pub fn border_color(self, color: Color) -> Self

Set border color.

Source

pub fn column_spacing(self, spacing: u16) -> Self

Set column spacing.

Source

pub fn header_color(self, color: Color) -> Self

Set header color.

Source

pub fn header_bg_color(self, color: Color) -> Self

Set header background color.

Source

pub fn header_bold(self, bold: bool) -> Self

Set whether header is bold.

Source

pub fn striped(self) -> Self

Enable striped rows.

Source

pub fn stripe_color(self, color: Color) -> Self

Set stripe color.

Source

pub fn selected(self, index: usize) -> Self

Set selected row index.

Source

pub fn selected_style( self, color: Option<Color>, bg_color: Option<Color>, ) -> Self

Set selected row colors.

Source

pub fn row_dividers(self) -> Self

Enable row dividers.

Source

pub fn width(self, width: u16) -> Self

Set table width.

Source

pub fn bg_color(self, color: Color) -> Self

Set background color for all cells.

Trait Implementations§

Source§

impl Clone for TableProps

Source§

fn clone(&self) -> TableProps

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TableProps

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TableProps

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.