bs

package module
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2025 License: GPL-3.0 Imports: 3 Imported by: 19

README

Bootstrap UI for Golang Open in Gitpod

An extensive Golang library for declaratve building of Bootstrap components.

Its an extension of the HTML Builder package: https://github.com/gouniverse/hb

You can find different examples below.

Alerts

bs.Alert().Class("alert-info").HTML("Info text")

bs.Alert().Class("alert-danger").HTML("Danger text")

bs.Alert().Class("alert-success").HTML("Success text")

bs.Alert().Class("alert-warning").HTML("Warning text")

Breadcrumbs

breadcrumbsPath := []bs.Breadcrumb{
	{
		Name: "Home",
		URL:  "/users",
		Icon: icons.Icon("bi-house-fill", 16, 16, "gray").ToHTML(),
	},
	{
		Name: "Profile",
		Icon: icons.Icon("bi-person-circle", 16, 16, "gray").ToHTML(),
		URL:  "/users/profile",
	},
	{
		Name: "Update details",
		URL:  "/users/profile/update",
	},
}

breadcrumbs := bs.Breadcrumbs(breadcrumbsPath).Style("background:#e9ecef;border-radius:10px;padding:10px;margin-bottom:10px;")

Result

Cards

card := bs.Card().ID("CardPreview").AddChildren([]hb.TagInterface{
	bs.CardHeader().Child(hb.NewHeading5().HTML("Preview")),
	bs.CardBody().Child(preview),
})

Tabs

bs.NavTabs().Children([]hb.TagInterface{
	bs.NavItem().Children([]hb.TagInterface{
		bs.NavLink().Class("active").Children([]hb.TagInterface{
			hb.NewSpan().HTML("Overview"),
		}),
	}),
	bs.NavItem().Children([]hb.TagInterface{
		bs.NavLink().Children([]hb.TagInterface{
			hb.NewSpan().HTML("Statistics"),
		}),
	}),
	bs.NavItem().Children([]hb.TagInterface{
		bs.NavLink().Children([]hb.TagInterface{
			hb.NewSpan().HTML("Preview"),
		}),
	}),
}),

Pills

bs.NavPills().Children([]hb.TagInterface{
	bs.NavItem().Children([]hb.TagInterface{
		bs.NavLink().Class("active").Children([]hb.TagInterface{
			hb.NewSpan().HTML("Overview"),
		}),
	}),
	bs.NavItem().Children([]hb.TagInterface{
		bs.NavLink().Children([]hb.TagInterface{
			hb.NewSpan().HTML("Statistics"),
		}),
	}),
	bs.NavItem().Children([]hb.TagInterface{
		bs.NavLink().Children([]hb.TagInterface{
			hb.NewSpan().HTML("Preview"),
		}),
	}),
}),

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert() *hb.Tag
func Breadcrumbs(breadcrumbs []Breadcrumb) *hb.Tag

func Button

func Button() *hb.Tag
func ButtonLink() *hb.Tag

func Card

func Card() *hb.Tag

func CardBody

func CardBody() *hb.Tag

func CardFooter

func CardFooter() *hb.Tag

func CardHeader

func CardHeader() *hb.Tag

func CardImageTop

func CardImageTop(src string) *hb.Tag

func CardTitle

func CardTitle() *hb.Tag

func Column

func Column(width int) *hb.Tag

func Container

func Container() *hb.Tag

func FormCheck

func FormCheck() *hb.Tag

func FormCheckBox

func FormCheckBox() *hb.Tag

func FormCheckLabel

func FormCheckLabel() *hb.Tag

func FormCheckRadio

func FormCheckRadio() *hb.Tag

func FormGroup

func FormGroup() *hb.Tag

func FormInput

func FormInput() *hb.Tag

func FormInputPlaintext

func FormInputPlaintext() *hb.Tag

func FormLabel

func FormLabel(label string) *hb.Tag

func FormSelect

func FormSelect() *hb.Tag

func FormSelectOption

func FormSelectOption(optionKey string, optionName string) *hb.Tag

func FormText

func FormText(text string) *hb.Tag

func FormTextArea

func FormTextArea() *hb.Tag

func InputGroup

func InputGroup() *hb.Tag

func InputGroupText

func InputGroupText() *hb.Tag
func Modal() *hb.Tag

func ModalBody

func ModalBody() *hb.Tag

func ModalContent

func ModalContent() *hb.Tag

func ModalDialog

func ModalDialog() *hb.Tag

func ModalFooter

func ModalFooter() *hb.Tag

func ModalHeader

func ModalHeader() *hb.Tag
func Nav() *hb.Tag
func NavItem() *hb.Tag
func NavLink() *hb.Tag
func NavPills() *hb.Tag
func NavTabs() *hb.Tag

func Pagination

func Pagination(options PaginationOptions) string

func Row

func Row() *hb.Tag

func TabContent

func TabContent() *hb.Tag

func TabPane

func TabPane() *hb.Tag

Types

type Breadcrumb struct {
	URL   string
	Name  string
	Class string
	Icon  string
}

type PaginationOptions

type PaginationOptions struct {
	NumberItems       int
	CurrentPageNumber int
	PerPage           int
	PagesToShow       int
	URL               string
	FirstPageStartsAt int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL