Columns powered by Flexbox

The b.Columns constructor creates a columns container.

ModifierAction
b.GaplessNo gap
b.ColumnGap(0)No gap
b.ColumnGap(1)0.25rem gap
b.ColumnGap(2)0.5rem gap
b.ColumnGap(3)0.75rem gap
b.ColumnGap(4)1rem gap
b.ColumnGap(5)1.25rem gap
b.ColumnGap(6)1.5rem gap
b.ColumnGap(7)1.75rem gap
b.ColumnGap(8)2rem gap
b.CenteredCenter columns
b.DesktopAllow columns only on desktops upward (not on tablets)
b.MobileAllow columns on mobile phones too
b.MultilineCreate a new line when columns do not fit in a single line
b.VCenteredCenter columns vertically

The gap may be breakpoint-based, with b.ColumnGap*.Mobile() to b.ColumnGap*.FullHD().

ChildAction
b.Column(...any)Add column to the <div class="columns"> element
e.ElementWrap element in a column and add it to the <div class="columns"> element
stringWrap text in a column and add it to the <div class="columns"> element
gomponents.Nodeof type gomponents.AttributeTypeApply attribute to the <div class="columns"> element
gomponents.Nodeof type gomponents.ElementTypeWrap element in a column and add it to the <div class="columns"> element
Anything elseApply child to the <div class="columns"> element

The b.Column constructor creates a single column.

ModifierAction
b.Full, b.Size(12)Set width to 100% (1212)
b.Size(11)Set width to 91.66% (1112)
b.Size(10)Set width to 83.33% (1012)
b.FourFifthsSet width to 80% (45)
b.ThreeQuarters, b.Size(9)Set width to 75% (34, 912)
b.TwoThirds, b.Size(8)Set width to 66.66% (23, 812)
b.ThreeFifthsSet width to 60% (35)
b.Size(7)Set width to 58.33% (712)
b.Half, b.Size(6)Set width to 50% (12, 612)
b.Size(5)Set width to 41.66% (512)
b.TwoFifthsSet width to 40% (25)
b.OneThird, b.Size(4)Set width to 33.33% (13, 412)
b.OneQuarter, b.Size(3)Set width to 25% (14, 312)
b.OneFifthSet width to 20% (15)
b.Size(2)Set width to 16.66% (212)
b.Size(1)Set width to 8.33% (112)
b.Offset(11)Set offset to 91.66% (1112)
b.Offset(10)Set offset to 83.33% (1012)
b.OffsetFourFifthsSet offset to 80% (45)
b.OffsetThreeQuarters, b.Offset(9)Set offset to 75% (34, 912)
b.OffsetTwoThirds, b.Offset(8)Set offset to 66.66% (23, 812)
b.OffsetThreeFifthsSet offset to 60% (35)
b.Offset(7)Set offset to 58.33% (712)
b.OffsetHalf, b.Offset(6)Set offset to 50% (12, 612)
b.Offset(5)Set offset to 41.66% (512)
b.OffsetTwoFifthsSet offset to 40% (25)
b.OffsetOneThird, b.Offset(4)Set offset to 33.33% (13, 412)
b.OffsetOneQuarter, b.Offset(3)Set offset to 25% (14, 312)
b.OffsetOneFifthSet offset to 20% (15)
b.Offset(2)Set offset to 16.66% (212)
b.Offset(1)Set offset to 8.33% (112)
b.NarrowThe column takes only the width it needs

The width, offset and narrow behaviour may be breakpoint-based, by calling .Mobile() to .FullHD() on the modifier(s).

Bulma example: Basics

Example
ResultHTML

First column

Second column

Third column

Fourth column

Code
b.Columns(
	b.Column(e.P("First column")),
	e.P("Second column"),
	b.Column(e.P("Third column")),
	e.P("Fourth column"),
)

Bulma examples: Sizes

Example
ResultHTML

is-four-fifths

Auto

Auto

is-three-quarters

Auto

Auto

is-two-thirds

Auto

Auto

is-three-fifths

Auto

Auto

is-half

Auto

Auto

is-two-fifths

Auto

Auto

is-one-third

Auto

Auto

is-one-quarter

Auto

Auto

is-one-fifth

Auto

Auto

Code
b.Columns(
	b.Column(
		b.SizeFourFifths,
		e.P("is-four-fifths"),
	),
	b.Column(e.P("Auto")),
	b.Column(e.P("Auto")),
),
b.Columns(
	b.Column(
		b.ThreeQuarters,
		e.P("is-three-quarters"),
	),
	b.Column(e.P("Auto")),
	b.Column(e.P("Auto")),
),
b.Columns(
	b.Column(
		b.TwoThirds,
		e.P("is-two-thirds"),
	),
	b.Column(e.P("Auto")),
	b.Column(e.P("Auto")),
),
b.Columns(
	b.Column(
		b.ThreeFifths,
		e.P("is-three-fifths"),
	),
	b.Column(e.P("Auto")),
	b.Column(e.P("Auto")),
),
b.Columns(
	b.Column(
		b.Half,
		e.P("is-half"),
	),
	b.Column(e.P("Auto")),
	b.Column(e.P("Auto")),
),
b.Columns(
	b.Column(
		b.TwoFifths,
		e.P("is-two-fifths"),
	),
	b.Column(e.P("Auto")),
	b.Column(e.P("Auto")),
),
b.Columns(
	b.Column(
		b.OneThird,
		e.P("is-one-third"),
	),
	b.Column(e.P("Auto")),
	b.Column(e.P("Auto")),
),
b.Columns(
	b.Column(
		b.OneQuarter,
		e.P("is-one-quarter"),
	),
	b.Column(e.P("Auto")),
	b.Column(e.P("Auto")),
),
b.Columns(
	b.Column(
		b.OneFifth,
		e.P("is-one-fifth"),
	),
	b.Column(e.P("Auto")),
	b.Column(e.P("Auto")),
)

12 columns system

Use bulma.ColSize1 to bulma.ColSize12.

Offset

Example
Code
b.Columns(
	b.Mobile,
	b.Column(
		b.Half,
		b.OffsetOneQuarter,
		e.P(
			e.Code("is-half"),
			e.Br(),
			e.Code("is-offset-one-quarter"),
		),
	),
),
b.Columns(
	b.Mobile,
	b.Column(
		b.ThreeFifths,
		b.OffsetOneFifth,
		e.P(
			e.Code("is-three-fifths"),
			e.Br(),
			e.Code("is-offset-one-fifth"),
		),
	),
),
b.Columns(
	b.Mobile,
	b.Column(
		b.Size(4),
		b.Offset(8),
		e.P(
			e.Code("is-4"),
			e.Br(),
			e.Code("is-offset-8"),
		),
	),
),
b.Columns(
	b.Mobile,
	b.Column(
		b.Size(11),
		b.Offset(1),
		e.P(
			e.Code("is-11"),
			e.Br(),
			e.Code("is-offset-1"),
		),
	),
)
ResultHTML

is-half
is-offset-one-quarter

is-three-fifths
is-offset-one-fifth

is-4
is-offset-8

is-11
is-offset-1

Narrow column

Example
Code
b.Columns(
	b.Column(
		b.Narrow,
		b.Box(
			e.Styles{"width": "200px"},
			b.Title(5, html.P, "Narrow column"),
			b.Subtitle(html.P, "This column is only 200px wide."),
		),
	),
	b.Column(
		b.Box(
			b.Title(5, html.P, "Flexible column"),
			b.Subtitle(html.P, "This column will take up the remaining space available."),
		),
	),
)
ResultHTML

Narrow column

This column is only 200px wide.

Flexible column

This column will take up the remaining space available.

Bulma examples: Responsiveness

Mobile columns

Example
Code
b.Columns(
	b.Mobile,
	b.Column(e.P("1")),
	b.Column(e.P("2")),
	b.Column(e.P("3")),
	b.Column(e.P("4")),
)
ResultHTML

1

2

3

4

Example
Code
b.Columns(
	b.ColDesktop,
	b.Column(e.P("1")),
	b.Column(e.P("2")),
	b.Column(e.P("3")),
	b.Column(e.P("4")),
)
ResultHTML

1

2

3

4

Different column sizes per breakpoint

Example
Code
b.Columns(
	b.Mobile,
	b.Column(
		b.ThreeQuarters.Mobile(),
		b.TwoThirds.Tablet(),
		b.Half.Desktop(),
		b.OneThird.Widescreen(),
		b.OneQuarter.FullHD(),
		e.P(
			e.Code("is-three-quarters-mobile"),
			e.Br(),
			e.Code("is-two-thirds-tablet"),
			e.Br(),
			e.Code("is-half-desktop"),
			e.Br(),
			e.Code("is-one-third-widescreen"),
			e.Br(),
			e.Code("is-one-quarter-fullhd"),
		),
	),
	b.Column(e.P("2")),
	b.Column(e.P("3")),
	b.Column(e.P("4")),
	b.Column(e.P("5")),
)
ResultHTML

is-three-quarters-mobile
is-two-thirds-tablet
is-half-desktop
is-one-third-widescreen
is-one-quarter-fullhd

2

3

4

5

Bulma examples: Nesting

Example
ResultHTML

First column

First nested column

Second nested column

Second column

50%

Auto

Auto

Code
b.Columns(
	b.Column(
		e.P(
			b.BackgroundInfo,
			"First column",
		),
		b.Columns(
			b.Mobile,
			b.Column(
				e.P(
					b.BackgroundInfo,
					"First nested column",
				),
			),
			b.Column(
				e.P(
					b.BackgroundInfo,
					"Second nested column",
				),
			),
		),
	),
	b.Column(
		e.P(
			b.BackgroundDanger,
			"Second column",
		),
		b.Columns(
			b.Mobile,
			b.Column(
				b.Half,
				e.P(
					b.BackgroundDanger,
					"50%",
				),
			),
			b.Column(
				e.P(
					b.BackgroundDanger,
					"Auto",
				),
			),
			b.Column(
				e.P(
					b.BackgroundDanger,
					"Auto",
				),
			),
		),
	),
)

Bulma examples: Gap

Gapless

Example
Code
b.Columns(
	b.Gapless,
	b.Column(e.P("No gap")),
	b.Column(e.P("No gap")),
	b.Column(e.P("No gap")),
	b.Column(e.P("No gap")),
)
ResultHTML

No gap

No gap

No gap

No gap

Example
Code
b.Columns(
	b.Gapless,
	b.Multiline,
	b.Mobile,
	b.Column(
		b.OneQuarter,
		e.P("is-one-quarter"),
	),
	b.Column(
		b.OneQuarter,
		e.P("is-one-quarter"),
	),
	b.Column(
		b.OneQuarter,
		e.P("is-one-quarter"),
	),
	b.Column(
		b.OneQuarter,
		e.P("is-one-quarter"),
	),
	b.Column(
		b.Half,
		e.P("is-half"),
	),
	b.Column(
		b.OneQuarter,
		e.P("is-one-quarter"),
	),
	b.Column(
		b.OneQuarter,
		e.P("is-one-quarter"),
	),
	b.Column(
		b.OneQuarter,
		e.P("is-one-quarter"),
	),
	b.Column(
		e.P("Auto"),
	),
)
ResultHTML

is-one-quarter

is-one-quarter

is-one-quarter

is-one-quarter

is-half

is-one-quarter

is-one-quarter

is-one-quarter

Auto

Variable gap

Use b.ColumnGap(0) to b.ColumnGap(8).

Breakpoint based column gaps

Example
Code
b.Columns(
	b.ColumnGap(1).Mobile(),
	b.ColumnGap(0).Tablet(),
	b.ColumnGap(3).Desktop(),
	b.ColumnGap(8).Widescreen(),
	b.ColumnGap(2).FullHD(),
	b.Column(e.P("Column")),
	b.Column(e.P("Column")),
	b.Column(e.P("Column")),
	b.Column(e.P("Column")),
	b.Column(e.P("Column")),
	b.Column(e.P("Column")),
)
ResultHTML

Column

Column

Column

Column

Column

Column

Bulma examples: Options

Vertical alignment

Example
Code
b.Columns(
		b.VCentered,
		b.Column(
			b.Size(8),
			e.P("First column"),
		),
		b.Column(
			e.P("Second column with more content. This is so you can see the vertical alignment."),
		),
	)
ResultHTML

First column

Second column with more content. This is so you can see the vertical alignment.

Multiline

Example
Code
b.Columns(
		b.Multiline,
		b.Mobile,
		b.Column(
			b.OneQuarter,
			e.P("is-one-quarter"),
		),
		b.Column(
			b.OneQuarter,
			e.P("is-one-quarter"),
		),
		b.Column(
			b.OneQuarter,
			e.P("is-one-quarter"),
		),
		b.Column(
			b.OneQuarter,
			e.P("is-one-quarter"),
		),
		b.Column(
			b.Half,
			e.P("is-half"),
		),
		b.Column(
			b.OneQuarter,
			e.P("is-one-quarter"),
		),
		b.Column(
			b.OneQuarter,
			e.P("is-one-quarter"),
		),
		b.Column(
			b.OneQuarter,
			e.P("is-one-quarter"),
		),
		b.Column(
			e.P("Auto"),
		),
	)
ResultHTML

is-one-quarter

is-one-quarter

is-one-quarter

is-one-quarter

is-half

is-one-quarter

is-one-quarter

is-one-quarter

Auto

Centering columns

Example
Code
b.Columns(
		b.Mobile,
		b.Centered,
		b.Column(
			b.Half,
			e.P(e.Code("is-half")),
		),
	)
ResultHTML

is-half

Example
Code
b.Columns(
		b.Mobile,
		b.Multiline,
		b.Centered,
		b.Column(
			b.Narrow,
			e.P(
				e.Code("is-narrow"),
				e.Br(),
				"First column",
			),
		),
		b.Column(
			b.Narrow,
			e.P(
				e.Code("is-narrow"),
				e.Br(),
				"Our second column",
			),
		),
		b.Column(
			b.Narrow,
			e.P(
				e.Code("is-narrow"),
				e.Br(),
				"Third column",
			),
		),
		b.Column(
			b.Narrow,
			e.P(
				e.Code("is-narrow"),
				e.Br(),
				"The fourth column",
			),
		),
		b.Column(
			b.Narrow,
			e.P(
				e.Code("is-narrow"),
				e.Br(),
				"Fifth column",
			),
		),
	)
ResultHTML

is-narrow
First column

is-narrow
Our second column

is-narrow
Third column

is-narrow
The fourth column

is-narrow
Fifth column