pub struct GridLayoutProps {
pub layout: Signal<Vec<LayoutItem>>,
pub cols: i32,
pub row_height: f32,
pub margin: (i32, i32),
pub compaction: CompactionType,
pub render_item: fn(LayoutItem) -> Element,
pub on_layout_change: Option<EventHandler<Vec<LayoutItem>>>,
pub container_padding: (i32, i32),
pub collision_strategy: CollisionStrategy,
pub on_layout_event: Option<EventHandler<LayoutEvent>>,
pub emit_interaction_updates: bool,
pub keyboard_cell_nudge: bool,
}Expand description
Props for the GridLayout component.
Fields§
§layout: Signal<Vec<LayoutItem>>Reactive signal containing the current arrangement of items.
cols: i32Fixed number of columns for the grid. Change this to trigger a re-render and re-compaction of the layout.
row_height: f32Base height for a single grid row.
margin: (i32, i32)Spacing between items (horizontal, vertical).
compaction: CompactionTypeStrategy for compacting items (Gravity or FreePlacement).
render_item: fn(LayoutItem) -> ElementRender function for the visual content of each item.
on_layout_change: Option<EventHandler<Vec<LayoutItem>>>Optional event handler triggered after an item is moved or resized.
container_padding: (i32, i32)Padding inside the container around the grid content (px), for visual alignment with CSS.
collision_strategy: CollisionStrategyCollision policy while dragging/resizing.
on_layout_event: Option<EventHandler<LayoutEvent>>Structured lifecycle events (start/stop/update).
emit_interaction_updates: boolWhen true and on_layout_event is set, emit InteractionPhase::Update on every pointer move.
keyboard_cell_nudge: boolWhen true, arrow keys move the focused widget by one grid cell (focus the widget body first).
Implementations§
Source§impl GridLayoutProps
impl GridLayoutProps
Sourcepub fn builder() -> GridLayoutPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> GridLayoutPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building GridLayoutProps.
On the builder, call .layout(...), .cols(...), .row_height(...), .margin(...), .compaction(...), .render_item(...), .on_layout_change(...)(optional), .container_padding(...)(optional), .collision_strategy(...)(optional), .on_layout_event(...)(optional), .emit_interaction_updates(...)(optional), .keyboard_cell_nudge(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of GridLayoutProps.
Trait Implementations§
Source§impl Clone for GridLayoutProps
impl Clone for GridLayoutProps
Source§fn clone(&self) -> GridLayoutProps
fn clone(&self) -> GridLayoutProps
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more