Grid

The b.Grid constructor creates a smart grid.

ModifierAction
b.ColMin(1) to b.ColMin(32))Set minimum column width to 1.5rem, 3rem, 4.5rem, [...], 46.5rem or 48rem
b.Gap(0) to b.Gap(8) with 0.5 stepsSet gap to 0, 0.25rem, 0.5rem, 0.75rem, 1rem, 1.25rem, 1.5rem, 1.75rem, 2rem, 2.25rem, 2.5rem, 2.75rem, 3rem, 3.25rem, 3.5rem, 3.75rem or 4rem
b.ColGap(0) to b.ColGap(8) with 0.5 stepsSet column gap to 0, 0.25rem, 0.5rem, 0.75rem, 1rem, 1.25rem, 1.5rem, 1.75rem, 2rem, 2.25rem, 2.5rem, 2.75rem, 3rem, 3.25rem, 3.5rem, 3.75rem or 4rem
b.RowGap(0) to b.RowGap(8) with 0.5 stepsSet row gap to 0, 0.25rem, 0.5rem, 0.75rem, 1rem, 1.25rem, 1.5rem, 1.75rem, 2rem, 2.25rem, 2.5rem, 2.75rem, 3rem, 3.25rem, 3.5rem, 3.75rem or 4rem
ChildAction
b.Cell(...any)Add cell to the <div class="grid"> element
e.ElementWrap element in a cell and add it to the <div class="grid"> element
gomponents.Nodeof type gomponents.AttributeTypeApply attribute to the <div class="grid"> element
gomponents.Nodeof type gomponents.ElementTypeWrap element in a cell and add it to the <div class="grid"> element
Anything elseApply child to the <div class="grid"> element

The b.FixedGrid constructor creates a fixed grid.

ModifierAction
b.ColMin(1) to b.ColMin(32))Set minimum column width to 1.5rem, 3rem, 4.5rem, [...], 46.5rem or 48rem
b.Gap(0) to b.Gap(8) with 0.5 stepsSet gap to 0, 0.25rem, 0.5rem, 0.75rem, 1rem, 1.25rem, 1.5rem, 1.75rem, 2rem, 2.25rem, 2.5rem, 2.75rem, 3rem, 3.25rem, 3.5rem, 3.75rem or 4rem
b.ColGap(0) to b.ColGap(8) with 0.5 stepsSet column gap to 0, 0.25rem, 0.5rem, 0.75rem, 1rem, 1.25rem, 1.5rem, 1.75rem, 2rem, 2.25rem, 2.5rem, 2.75rem, 3rem, 3.25rem, 3.5rem, 3.75rem or 4rem
b.RowGap(0) to b.RowGap(8) with 0.5 stepsSet row gap to 0, 0.25rem, 0.5rem, 0.75rem, 1rem, 1.25rem, 1.5rem, 1.75rem, 2rem, 2.25rem, 2.5rem, 2.75rem, 3rem, 3.25rem, 3.5rem, 3.75rem or 4rem
b.Cols(1) to b.Cols(12)Set columns count to 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 or 12
b.AutoCountSet columns count to:
  • 2 on mobile
  • 4 on tablet
  • 8 on desktop
  • 12 on widescreen
  • 16 on full HD
ChildAction
b.OnFixedGrid(...any)Apply children to the <div class="fixed-grid"> element
b.OnGrid(...any)Apply children to the <div class="grid"> element
b.Cell(...any)Add cell to the <div class="grid"> element
e.ElementWrap element in a cell and add it to the <div class="grid"> element
gomponents.Nodeof type gomponents.AttributeTypeApply attribute to the <div class="grid"> element
gomponents.Nodeof type gomponents.ElementTypeWrap element in a cell and add it to the <div class="grid"> element
Anything elseApply child to the <div class="grid"> element

The columns count may be breakpoint-based, with b.Cols(...).Mobile() to b.Cols(...).FullHD().

The b.Cell constructor creates a single grid cell.

ModifierAction
b.ColStart(1) to b.ColStart(12)Start the cell at the given column (other values are treated as end, ie. the last column)
b.ColFromEnd(1) to b.ColFromEnd(12)End the cell at the given column
b.ColSpan(1) to b.ColSpan(12)Span the cell over this number of columns
b.RowStart(1) to b.RowStart(12)Start the cell at the given row (other values are treated as end, ie. the last row)
b.RowFromEnd(1) to b.RowFromEnd(12)End the cell at the given row
b.RowSpan(1) to b.RowSpan(12)Span the cell over this number of rows

The column and row start/end/span may be breakpoint-based, with .Mobile() to .FullHD().

Bulma example: Smart Grid

Example
Code
b.Grid(
	b.Cell("Cell 1"),
	b.Cell("Cell 2"),
	b.Cell("Cell 3"),
	b.Cell("Cell 4"),
	b.Cell("Cell 5"),
	b.Cell("Cell 6"),
	b.Cell("Cell 7"),
	b.Cell("Cell 8"),
	b.Cell("Cell 9"),
	b.Cell("Cell 10"),
	b.Cell("Cell 11"),
	b.Cell("Cell 12"),
	b.Cell("Cell 13"),
	b.Cell("Cell 14"),
	b.Cell("Cell 15"),
	b.Cell("Cell 16"),
	b.Cell("Cell 17"),
	b.Cell("Cell 18"),
	b.Cell("Cell 19"),
	b.Cell("Cell 20"),
	b.Cell("Cell 21"),
	b.Cell("Cell 22"),
	b.Cell("Cell 23"),
	b.Cell("Cell 24"),
)
ResultHTML
Cell 1
Cell 2
Cell 3
Cell 4
Cell 5
Cell 6
Cell 7
Cell 8
Cell 9
Cell 10
Cell 11
Cell 12
Cell 13
Cell 14
Cell 15
Cell 16
Cell 17
Cell 18
Cell 19
Cell 20
Cell 21
Cell 22
Cell 23
Cell 24

Bulma examples: Fixed Grid

Example
Code
b.FixedGrid(
	b.Cell("Cell 1"),
	b.Cell("Cell 2"),
	b.Cell("Cell 3"),
	b.Cell("Cell 4"),
	b.Cell("Cell 5"),
	b.Cell("Cell 6"),
	b.Cell("Cell 7"),
	b.Cell("Cell 8"),
	b.Cell("Cell 9"),
	b.Cell("Cell 10"),
	b.Cell("Cell 11"),
	b.Cell("Cell 12"),
)
ResultHTML
Cell 1
Cell 2
Cell 3
Cell 4
Cell 5
Cell 6
Cell 7
Cell 8
Cell 9
Cell 10
Cell 11
Cell 12

Auto Count Fixed Grid

Example
ResultHTML
Cell 1
Cell 2
Cell 3
Cell 4
Cell 5
Cell 6
Cell 7
Cell 8
Cell 9
Cell 10
Cell 11
Cell 12
Cell 13
Cell 14
Cell 15
Cell 16
Code
b.FixedGrid(
	b.AutoCount,
	b.Cell("Cell 1"),
	b.Cell("Cell 2"),
	b.Cell("Cell 3"),
	b.Cell("Cell 4"),
	b.Cell("Cell 5"),
	b.Cell("Cell 6"),
	b.Cell("Cell 7"),
	b.Cell("Cell 8"),
	b.Cell("Cell 9"),
	b.Cell("Cell 10"),
	b.Cell("Cell 11"),
	b.Cell("Cell 12"),
	b.Cell("Cell 13"),
	b.Cell("Cell 14"),
	b.Cell("Cell 15"),
	b.Cell("Cell 16"),
)

Bulma examples: Grid Cells

Column Start

Example
ResultHTML
Cell 1
Cell 2
Cell 3
Cell 4
Cell 5
Cell 6
Code
b.FixedGrid(
	b.Cols(4),
	b.Cell("Cell 1"),
	b.Cell(b.ColStart(3), "Cell 2"),
	b.Cell("Cell 3"),
	b.Cell("Cell 4"),
	b.Cell("Cell 5"),
	b.Cell("Cell 6"),
)

Column From End

Example
ResultHTML
Cell 1
Cell 2
Cell 3
Cell 4
Cell 5
Cell 6
Code
b.FixedGrid(
	b.Cols(4),
	b.Cell("Cell 1"),
	b.Cell(b.ColFromEnd(2), "Cell 2"),
	b.Cell("Cell 3"),
	b.Cell("Cell 4"),
	b.Cell("Cell 5"),
	b.Cell("Cell 6"),
)

Column Span

Example
ResultHTML
Cell 1
Cell 2
Cell 3
Cell 4
Cell 5
Cell 6
Code
b.FixedGrid(
	b.Cols(4),
	b.Cell("Cell 1"),
	b.Cell(b.ColSpan(2), "Cell 2"),
	b.Cell("Cell 3"),
	b.Cell("Cell 4"),
	b.Cell("Cell 5"),
	b.Cell("Cell 6"),
)

Row Start

Example
ResultHTML
Cell 1
Cell 2
Cell 3
Cell 4
Cell 5
Cell 6
Code
b.FixedGrid(
	b.Cols(4),
	b.Cell("Cell 1"),
	b.Cell(b.RowStart(3), "Cell 2"),
	b.Cell("Cell 3"),
	b.Cell("Cell 4"),
	b.Cell("Cell 5"),
	b.Cell("Cell 6"),
)

Row From End

Example
ResultHTML
Cell 1
Cell 2
Cell 3
Cell 4
Cell 5
Cell 6
Code
b.FixedGrid(
	b.Cols(4),
	b.Cell("Cell 1"),
	b.Cell(b.RowFromEnd(1), "Cell 2"),
	b.Cell("Cell 3"),
	b.Cell("Cell 4"),
	b.Cell("Cell 5"),
	b.Cell("Cell 6"),
)

Row Span

Example
ResultHTML
Cell 1
Cell 2
Cell 3
Cell 4
Cell 5
Cell 6
Code
b.FixedGrid(
	b.Cols(4),
	b.Cell("Cell 1"),
	b.Cell(b.RowSpan(2), "Cell 2"),
	b.Cell("Cell 3"),
	b.Cell("Cell 4"),
	b.Cell("Cell 5"),
	b.Cell("Cell 6"),
)