bs

package module
v0.12.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

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.TagInterface
func Breadcrumbs(breadcrumbs []Breadcrumb) hb.TagInterface

func Button added in v0.0.4

func Button() hb.TagInterface
func ButtonLink() hb.TagInterface

func Card added in v0.0.3

func Card() hb.TagInterface

func CardBody added in v0.0.3

func CardBody() hb.TagInterface

func CardFooter added in v0.0.3

func CardFooter() hb.TagInterface

func CardHeader added in v0.0.3

func CardHeader() hb.TagInterface

func CardImageTop added in v0.1.0

func CardImageTop(src string) hb.TagInterface

func CardTitle added in v0.2.0

func CardTitle() hb.TagInterface

func Column

func Column(width int) hb.TagInterface

func Container

func Container() hb.TagInterface

func FormCheck added in v0.8.0

func FormCheck() hb.TagInterface

func FormCheckBox added in v0.10.0

func FormCheckBox() hb.TagInterface

func FormCheckLabel added in v0.8.0

func FormCheckLabel() hb.TagInterface

func FormCheckRadio added in v0.9.0

func FormCheckRadio() hb.TagInterface

func FormGroup

func FormGroup() hb.TagInterface

func FormInput

func FormInput() hb.TagInterface

func FormInputPlaintext added in v0.4.4

func FormInputPlaintext() hb.TagInterface

func FormLabel

func FormLabel(label string) hb.TagInterface

func FormSelect

func FormSelect() hb.TagInterface

func FormSelectOption

func FormSelectOption(optionKey string, optionName string) hb.TagInterface

func FormText

func FormText(text string) hb.TagInterface

func FormTextArea added in v0.6.1

func FormTextArea() hb.TagInterface

func InputGroup added in v0.7.0

func InputGroup() hb.TagInterface

func InputGroupText added in v0.7.0

func InputGroupText() hb.TagInterface
func Modal() hb.TagInterface

func ModalBody added in v0.4.5

func ModalBody() hb.TagInterface

func ModalContent added in v0.4.6

func ModalContent() hb.TagInterface

func ModalDialog added in v0.4.5

func ModalDialog() hb.TagInterface

func ModalFooter added in v0.4.5

func ModalFooter() hb.TagInterface

func ModalHeader added in v0.4.5

func ModalHeader() hb.TagInterface
func Nav() hb.TagInterface
func NavItem() hb.TagInterface
func NavLink() hb.TagInterface
func NavPills() hb.TagInterface
func NavTabs() hb.TagInterface

func Pagination added in v0.4.2

func Pagination(options PaginationOptions) string

func Row added in v0.0.2

func Row() hb.TagInterface

func TabContent added in v0.0.2

func TabContent() hb.TagInterface

func TabPane added in v0.0.2

func TabPane() hb.TagInterface

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