Material design’s responsive UI is based on a column-variate grid layout. It has 12 columns on desktop, 8 columns on tablet and 4 columns on phone.
import Material.LayoutGrid as LayoutGrid
exposing
( layoutGrid
, layoutGridCell
, layoutGridInner
)
main =
layoutGrid []
[ layoutGridInner []
[ layoutGridCell [] []
, layoutGridCell [] []
, layoutGridCell [] []
]
]Cell view function
Mandatory wrapper around layoutGridCell
Cells span by default four columns within the grid. Use one of the following functions to change this behavior.
Change a cell to span one column
Change a cell to span two columns
Change a cell to span three columns
Change a cell to span four columns
Change a cell to span five columns
Change a cell to span six columns
Change a cell to span seven columns
Change a cell to span eight columns
Change a cell to span nine columns
Change a cell to span ten columns
Change a cell to span eleven columns
Change a cell to span twelve columns
Cells are by default stretched. You can add attributes alignTop,
alignMiddle or alignBottom to a cell to change this behavior.
Aligns a cell to the top
Aligns a cell to the middle
Aligns a cell to the bottom
The layout grid is by default center aligned. You can add attributes
alignLeft or alignRight to the layoutGrid to change this behavior.
Note that effects will only be visible if the layout grid does not span the entire available width.
Aligns the layout grid to the left
Aligns the layout grid to the right
When your contents need extra structure that cannot be supported by a single
layout grid, you can nest layout grids within each other. To nest layout grid,
add a new layoutGridInner around nested layoutGridCells within an existing
layoutGridCell.
The nested layout grid behaves exactly like when they are not nested, e.g, they have 12 columns on desktop, 8 columns on tablet and 4 columns on phone. They also use the same gutter size as their parents, but margins are not re-introduced since they are living within another cell.
However, the Material Design guidelines do not recommend having a deeply nested grid as it might mean an over complicated UX.
layoutGrid []
[ layoutGridInner []
[ layoutGridCell []
[ layoutGridInner []
[ layoutGridCell [] []
, layoutGridCell [] []
]
]
, layoutGridCell [] []
]
]Change a cell to span one column (desktop only)
Change a cell to span two columns (desktop only)
Change a cell to span three columns (desktop only)
Change a cell to span four columns (desktop only)
Change a cell to span five columns (desktop only)
Change a cell to span six columns (desktop only)
Change a cell to span seven columns (desktop only)
Change a cell to span eight columns (desktop only)
Change a cell to span nine columns (desktop only)
Change a cell to span ten columns (desktop only)
Change a cell to span eleven columns (desktop only)
Change a cell to span twelve columns (desktop only)
Change a cell to span one column (tablet only)
Change a cell to span two columns (tablet only)
Change a cell to span three columns (tablet only)
Change a cell to span four columns (tablet only)
Change a cell to span five columns (tablet only)
Change a cell to span six columns (tablet only)
Change a cell to span seven columns (tablet only)
Change a cell to span eight columns (tablet only)
Change a cell to span one column (phone only)
Change a cell to span two columns (phone only)
Change a cell to span three columns (phone only)
Change a cell to span four columns (phone only)
Grid view function