Hero

The b.Hero constructor creates a hero.

ModifierAction
b.PrimarySet color to primary
b.LinkSet color to link
b.InfoSet color to info
b.SuccessSet color to success
b.WarningSet color to warning
b.DangerSet color to danger
b.SmallSet size to small
b.MediumSet size to medium
b.LargeSet size to large
b.HalfHeightSet size to 50% of the height of the viewport
b.FullHeightSet size to 100% of the height of the viewport
b.FullHeightWithNavbarSet size to 100% of the height of the viewport minus the navbar height
ChildAction
b.OnSection(...any)Apply children to the <section class="hero"> element
b.OnBody(...any)Apply children to the <div class="hero-body"> element
b.HeroHead(...any)Apply children to the <div class="hero-head"> element
b.HeroFoot(...any)Apply children to the <div class="hero-foot"> element
e.ElementAdd element to the <div class="hero-body"> element
gomponents.Nodeof type gomponents.AttributeTypeApply attribute to the <section class="hero"> element
gomponents.Nodeof type gomponents.ElementTypeAdd element to the <div class="hero-body"> element
Anything elseApply child to the <section class="hero"> element

The head, body and foot elements are created only if at least one child has been provided for the part.

Bulma examples

The hero body is implied when you provide elements as children to b.Hero:

Example
Code
b.Hero(
	b.Title(html.P, "Hero title"),
	b.Subtitle(html.P ,"Hero subtitle"),
)
ResultHTML

Hero title

Hero subtitle

Colors

Example
Code
b.Hero(
	b.Primary,
	b.Title(html.P, "Primary hero"),
	b.Subtitle(html.P ,"Primary subtitle"),
)
ResultHTML

Primary hero

Primary subtitle

Example
Code
b.Hero(
	b.Link,
	b.Title(html.P, "Link hero"),
	b.Subtitle(html.P ,"Link subtitle"),
)
ResultHTML
Example
Code
b.Hero(
	b.Info,
	b.Title(html.P, "Info hero"),
	b.Subtitle(html.P ,"Info subtitle"),
)
ResultHTML

Info hero

Info subtitle

Example
Code
b.Hero(
	b.Success,
	b.Title(html.P, "Success hero"),
	b.Subtitle(html.P ,"Success subtitle"),
)
ResultHTML

Success hero

Success subtitle

Example
Code
b.Hero(
	b.Warning,
	b.Title(html.P, "Warning hero"),
	b.Subtitle(html.P ,"Warning subtitle"),
)
ResultHTML

Warning hero

Warning subtitle

Example
Code
b.Hero(
	b.Danger,
	b.Title(html.P, "Danger hero"),
	b.Subtitle(html.P ,"Danger subtitle"),
)
ResultHTML

Danger hero

Danger subtitle

Sizes

Example
Code
b.Hero(
	b.Small, b.Primary,
	b.Title(html.P, "Small hero"),
	b.Subtitle(html.P, "Small subtitle"),
)
ResultHTML

Small hero

Small subtitle

Example
Code
b.Hero(
	b.Medium, b.Link,
	b.Title(html.P, "Medium hero"),
	b.Subtitle(html.P, "Medium subtitle"),
)
ResultHTML
Example
Code
b.Hero(
	b.Large, b.Info,
	b.Title(html.P, "Large hero"),
	b.Subtitle(html.P, "Large subtitle"),
)
ResultHTML

Large hero

Large subtitle

Example
Code
b.Hero(
	b.HalfHeight, b.Success,
	e.Div(
		b.Title(html.P, "Half height hero"),
		b.Subtitle(html.P, "Half height subtitle"),
	),
)
ResultHTML

Half height hero

Half height subtitle

Example
Code
b.Hero(
	b.FullHeight, b.Danger,
	e.Div(
		b.Title(html.P, "Full height hero"),
		b.Subtitle(html.P, "Full height subtitle"),
	),
)
ResultHTML

Full height hero

Full height subtitle

Fullheight with navbar

Example
ResultHTML
Code
b.Navbar(
	b.NavbarStart(
		b.NavbarAHref("#", "Home"),
		b.NavbarAHref("#", "Documentation"),
	),
	b.NavbarEnd(
		b.NavbarItem(
			b.Buttons(
				b.ButtonA(b.Dark, "Github"),
				b.ButtonA(b.Link, "Download"),
			),
		),
	),
),
b.Hero(
	b.Link, b.FullHeightWithNavbar,
	b.Title(html.P, "Fullheight hero with navbar"),
)

Fullheight hero in 3 parts

Use b.HeroHead and b.HeroFoot to define body header and footer. Please note they can be used multiple times, in which case the children will be aggregated.

Example
ResultHTML
Code
b.Hero(
	b.Primary, b.Medium,
	// Hero head: will stick at the top
	b.HeroHead(
		b.Navbar(
			b.NavbarBrand(
				b.NavbarAHref(
					"#",
					e.ImgSrc("https://bulma.io/images/bulma-type-white.png", e.Alt("Logo")),
				),
			),
			b.NavbarEnd(
				b.NavbarAHref("#", b.Active, "Home"),
				b.NavbarAHref("#", "Examples"),
				b.NavbarAHref("#", "Documentation"),
				b.NavbarItem(
					html.Span,
					b.ButtonA(
						b.Primary, b.Inverted,
						fa.Icon(fa.Brand, "github"),
						"Download",
					),
				),
			),
		),
	),

	// Hero content: will be in the middle
	b.Container(
		b.TextCentered,
		b.Title(html.P, "Title"),
		b.Subtitle(html.P, "Subtitle"),
	),

	// Hero footer: will stick at the bottom
	b.HeroFoot(
		b.Tabs(
			b.Container,
			b.TabLink(b.Active, "Overview"),
			b.TabLink("Modifiers"),
			b.TabLink("Grid"),
			b.TabLink("Elements"),
			b.TabLink("Components"),
			b.TabLink("Layout"),
		),
	),
)
Example
ResultHTML
Code
b.Hero(
	b.Info, b.Large,
	b.HeroHead(
		b.Navbar(
			b.Container,
			b.NavbarBrand(
				b.NavbarAHref(
					"#",
					e.ImgSrc("https://bulma.io/images/bulma-type-white.png", e.Alt("Logo")),
				),
			),
			b.NavbarEnd(
				b.NavbarAHref("#", b.Active, "Home"),
				b.NavbarAHref("#", "Examples"),
				b.NavbarAHref("#", "Documentation"),
				b.NavbarItem(
					html.Span,
					b.ButtonA(
						b.Primary, b.Inverted,
						fa.Icon(fa.Brand, "github"),
						"Download",
					),
				),
			),
		),
	),
	b.Container(
		b.TextCentered,
		b.Title(html.P, "Title"),
		b.Subtitle(html.P, "Subtitle"),
	),
	b.HeroFoot(
		b.Tabs(
			b.Boxed, b.FullWidth,
			b.Container,
			b.TabLink(b.Active, "Overview"),
			b.TabLink("Modifiers"),
			b.TabLink("Grid"),
			b.TabLink("Elements"),
			b.TabLink("Components"),
			b.TabLink("Layout"),
		),
	),
)
Example
ResultHTML
Code
b.Hero(
	b.Success, b.FullHeight,
	b.HeroHead(
		b.Navbar(
			b.Container,
			b.NavbarBrand(
				b.NavbarAHref(
					"#",
					e.ImgSrc("https://bulma.io/images/bulma-type-white.png", e.Alt("Logo")),
				),
			),
			b.NavbarEnd(
				b.NavbarAHref("#", b.Active, "Home"),
				b.NavbarAHref("#", "Examples"),
				b.NavbarAHref("#", "Documentation"),
				b.NavbarItem(
					html.Span,
					b.ButtonA(
						b.Primary, b.Inverted,
						fa.Icon(fa.Brand, "github"),
						"Download",
					),
				),
			),
		),
	),
	b.Container(
		b.TextCentered,
		b.Title(html.P, "Title"),
		b.Subtitle(html.P, "Subtitle"),
	),
	b.HeroFoot(
		b.Tabs(
			b.Boxed, b.FullWidth,
			b.Container,
			b.TabLink(b.Active, "Overview"),
			b.TabLink("Modifiers"),
			b.TabLink("Grid"),
			b.TabLink("Elements"),
			b.TabLink("Components"),
			b.TabLink("Layout"),
		),
	),
)