GridView

Trait GridView 

Source
pub trait GridView: View {
    // Provided methods
    fn grid_auto_flow(self, flow: GridAutoFlow) -> Self { ... }
    fn grid_auto_columns(self, tracks: Vec<GridTrack>) -> Self { ... }
    fn grid_auto_rows(self, tracks: Vec<GridTrack>) -> Self { ... }
    fn grid_template_columns(self, tracks: Vec<RepeatedGridTrack>) -> Self { ... }
    fn grid_template_rows(self, tracks: Vec<RepeatedGridTrack>) -> Self { ... }
    fn justify_content(self, justify: JustifyContent) -> Self { ... }
    fn align_items(self, align_items: AlignItems) -> Self { ... }
    fn row_gap(self, gap: Val) -> Self { ... }
    fn column_gap(self, gap: Val) -> Self { ... }
}
Expand description

Provides a fluent interface for configuring grid layout containers.

This trait is intended for views that participate in CSS-like grid layouts. It enables precise definition of tracks (rows and columns), gaps, flow behavior, and alignment along both axes, using a builder-style API.

Provided Methods§

Source

fn grid_auto_flow(self, flow: GridAutoFlow) -> Self

Sets the flow algorithm used to place items in the grid.

§Arguments
  • flow – Determines item placement strategy, such as Row, Column, RowDense, or ColumnDense.
Source

fn grid_auto_columns(self, tracks: Vec<GridTrack>) -> Self

Specifies the sizing behavior for automatically created columns.

Applies when children overflow the defined template or no template columns are set.

§Arguments
  • tracks – A vector of GridTrack values that define implicit column sizing.
Source

fn grid_auto_rows(self, tracks: Vec<GridTrack>) -> Self

Specifies the sizing behavior for automatically created rows.

Applies when content exceeds the defined row template.

§Arguments
  • tracks – A vector of GridTrack values that define implicit row sizing.
Source

fn grid_template_columns(self, tracks: Vec<RepeatedGridTrack>) -> Self

Defines the column track template for this grid.

Explicitly sets the layout behavior of each column.

§Arguments
  • tracks – A vector of RepeatedGridTrack values to control each column’s size and repeat behavior.
Source

fn grid_template_rows(self, tracks: Vec<RepeatedGridTrack>) -> Self

Defines the row track template for this grid.

Explicitly sets the layout behavior of each row.

§Arguments
  • tracks – A vector of RepeatedGridTrack values to control each row’s size and repeat behavior.
Source

fn justify_content(self, justify: JustifyContent) -> Self

Aligns all grid content along the main axis (horizontal in LTR layouts).

§Arguments
  • justify – Justification mode (e.g. Start, Center, SpaceBetween).
Source

fn align_items(self, align_items: AlignItems) -> Self

Aligns grid items along the cross axis (vertical in LTR layouts).

§Arguments
  • align_items – Alignment mode for items within their cells.
Source

fn row_gap(self, gap: Val) -> Self

Sets the vertical spacing between grid rows.

§Arguments
  • gap – The space to insert between rows, using Val::Px, Val::Percent, etc.
Source

fn column_gap(self, gap: Val) -> Self

Sets the horizontal spacing between grid columns.

§Arguments
  • gap – The space to insert between columns, using Val::Px, Val::Percent, etc.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§