bs

package module
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: GPL-3.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 added in v0.4.1

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

func Button added in v0.0.4

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

func Card added in v0.0.3

func Card() *hb.Tag

func CardBody added in v0.0.3

func CardBody() *hb.Tag

func CardFooter added in v0.0.3

func CardFooter() *hb.Tag

func CardHeader added in v0.0.3

func CardHeader() *hb.Tag

func CardImageTop added in v0.1.0

func CardImageTop(src string) *hb.Tag

func CardTitle added in v0.2.0

func CardTitle() *hb.Tag

func Column

func Column(width int) *hb.Tag

func Container

func Container() *hb.Tag

func FormCheck added in v0.8.0

func FormCheck() *hb.Tag

func FormCheckBox added in v0.10.0

func FormCheckBox() *hb.Tag

func FormCheckLabel added in v0.8.0

func FormCheckLabel() *hb.Tag

func FormCheckRadio added in v0.9.0

func FormCheckRadio() *hb.Tag

func FormGroup

func FormGroup() *hb.Tag

func FormInput

func FormInput() *hb.Tag

func FormInputPlaintext added in v0.4.4

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 added in v0.6.1

func FormTextArea() *hb.Tag

func InputGroup added in v0.7.0

func InputGroup() *hb.Tag

func InputGroupText added in v0.7.0

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

func ModalBody added in v0.4.5

func ModalBody() *hb.Tag

func ModalContent added in v0.4.6

func ModalContent() *hb.Tag

func ModalDialog added in v0.4.5

func ModalDialog() *hb.Tag

func ModalFooter added in v0.4.5

func ModalFooter() *hb.Tag

func ModalHeader added in v0.4.5

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 added in v0.4.2

func Pagination(options PaginationOptions) string

func Row added in v0.0.2

func Row() *hb.Tag

func TabContent added in v0.0.2

func TabContent() *hb.Tag

func TabPane added in v0.0.2

func TabPane() *hb.Tag

Types

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

type PaginationOptions added in v0.4.2

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
⌂ 换网址