Modal

The b.Modal constructor creates a modal.

ChildAction
b.OnModal(...any)Apply children to the <div class="modal"> element
b.OnContent(...any)Apply children to the <div class="modal-content"> element
gomponents.Nodeof type gomponents.AttributeTypeApply attribute to the <div class="modal"> element
gomponents.Nodeof type gomponents.ElementTypeAdd element to the <div class="modal-content"> element
Anything elseApply child to the <div class="modal-content"> element

The b.ModalCard constructor creates a card modal.

ChildAction
b.OnModal(...any)Apply children to the <div class="modal"> element
b.OnCard(...any)Apply children to the <div class="modal-card"> element
b.ModalCardHead(...any)Apply children to the <div class="modal-card-head"> element
b.ModalCardTitle(...any)Add title to the <div class="modal-card-head"> element
b.ModalCardTitleWithClose(string)Add title with a close button to the <div class="modal-card-head"> element
b.ModalCardFoot(...any)Apply children to the <div class="modal-card-foot"> element
gomponents.Nodeof type gomponents.AttributeTypeApply attribute to the <div class="modal"> element
gomponents.Nodeof type gomponents.ElementTypeAdd element to the <div class="modal-card-body"> element
Anything elseApply child to the <div class="modal-card-body"> element

Bulma examples

Example
Code
b.Button(b.Primary, b.Large, e.OnClick(b.JSOpen("modal")), "Launch example modal"),
b.Modal(
	e.ID("modal"),
	b.Box(
		b.Media(
			b.MediaLeft(b.ImageImg("https://bulma.io/assets/images/placeholders/128x128.png", b.ImgSq64, b.ImgAlt("Image"))),
			b.Content(
				e.P(
					e.Strong("John Smith"), " ", e.Small("@johnsmith"), " ", e.Small("31m"), e.Br(),
					"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean efficitur sit amet massa fringilla egestas. Nullam condimentum luctus turpis.",
				),
			),
			b.Level(b.Mobile, b.LevelLeft(
				e.A(e.AriaLabel("retweet"), fa.Icon(fa.Solid, "retweet", b.Small)),
				e.A(e.AriaLabel("like"), fa.Icon(fa.Solid, "heart", b.Small)),
			)),
		),
	),
)
ResultHTML

Image modal

Example
Code
b.Button(b.Primary, b.Large, e.OnClick(b.JSOpen("modal-image")), "Launch image modal"),
b.Modal(
	e.ID("modal-image"),
	b.ImageImg("https://bulma.io/assets/images/placeholders/1280x960.png", html.P, b.Img4By3),
)
ResultHTML