use fission::prelude::*;
fission_component! {
pub OperationsGrid<()> {
props {
summary: Widget,
activity: Widget,
}
}
view(dashboard, _state, cx) {
let spacing = &cx.view.env().theme.tokens.spacing;
} =>
Grid(
columns: vec![GridTrack::Fr(2.0), GridTrack::Fr(1.0)],
rows: vec![GridTrack::Auto],
column_gap: spacing.l,
row_gap: spacing.l,
children: [
GridItem(dashboard.summary.clone()).cell(1, 1),
GridItem(dashboard.activity.clone()).cell(1, 2),
],
)
}
Field | Type | Meaning | Notes / default behavior |
|---|---|---|---|
id | Option<WidgetId> | Stable widget identity. | Defaults to None. |
children | Vec<Widget> | Grid children, usually GridItem nodes. | Defaults to an empty list. |
columns | Vec<GridTrack> | Column track definitions. | Defaults to an empty list, so define these explicitly in real layouts. |
rows | Vec<GridTrack> | Row track definitions. | Defaults to an empty list. |
column_gap | Option<f32> | Horizontal gap between columns. | Defaults to None. |
row_gap | Option<f32> | Vertical gap between rows. | Defaults to None. |
padding | [f32; 4] | Inner padding in [left, right, top, bottom] order. | Defaults to [0.0; 4]. |
Track type | Meaning | When to use it |
|---|---|---|
GridTrack::Points(x) | Fixed track size in layout points. | Use for known fixed rails such as headers or side gutters. |
GridTrack::Percent(x) | Track as a percentage. | Use when the design is explicitly percentage-based. |
GridTrack::Fr(x) | Fractional remaining space. | Use for most flexible dashboard-style layouts. |
GridTrack::Auto | Size from content and constraints. | Good for content-driven tracks. |
GridTrack::MinContent / MaxContent | Content-based intrinsic sizing. | Use only when you intentionally want intrinsic track behavior. |
GridTrack::minmax(min, max) | Track constrained between two track definitions. | Use for responsive cards that should never shrink below a readable size. |
GridTrack::repeat(count, tracks) | Fixed repeated track list. | Use for regular grids with a known number of columns or rows. |
GridTrack::auto_fit(track) | Repeat a track up to the available space and collapse empty tracks. | Use for responsive product or card grids. |
GridTrack::auto_fill(track) | Repeat a track up to the available space and keep empty tracks. | Use when empty slots should still reserve grid space. |