bs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package bs is a Bootstrap toolkit. It wraps Alert, Badge, Button, Card, List Group, Modal, Progress Bar, Spinner, and Table. It also implements Bootstrap utilities like size, spacing, text alignment, float, color and visibility.

Index

Constants

View Source
const (
	VSExtraSmall = ""
	VSSmall      = "sm"
	VSMedium     = "md"
	VSLarge      = "lg"
	VSExtraLarge = "xl"
)

pre-defined viewport size values.

View Source
const (
	SideLeft   = "left"
	SideRight  = "right"
	SideTop    = "top"
	SideBottom = "bottom"

	SideCenter = "center"

	SideNone = "none"

	// margin, padding
	SideNegative = "n"
	SideBlank    = ""
	SideAll      = ""
	SideX        = "x"
	SideY        = "y"

	// vertical alignment
	SideMiddle     = "middle"
	SideBaseline   = "baseline"
	SideTextTop    = "text-top"
	SideTextBottom = "text-bottom"

	// flex justify content.
	SideStart   = "start"
	SideEnd     = "end"
	SideBetween = "between"
	SideAround  = "around"
	SideStretch = "stretch"
)

pre-defined position values.

View Source
const (
	// for margin and padding
	Size0 = "0"
	Size1 = "1"
	Size2 = "2"
	Size3 = "3"
	Size4 = "4"
	Size5 = "5"

	// for width and height
	Size25   = "25"
	Size50   = "50"
	Size75   = "75"
	Size100  = "100"
	SizeAuto = "auto"
)

pre-defined bootstrap size values.

View Source
const (
	FGPrimary   = "text-primary"
	FGSecondary = "text-secondary"
	FGSuccess   = "text-success"
	FGDanger    = "text-danger"
	FGWarning   = "text-warning"
	FGInfo      = "text-info"
	FGLight     = "text-light"
	FGDark      = "text-dark"
	FGBody      = "text-body"
	FGMuted     = "text-muted"
	FGWhite     = "text-white"
	FGHalfBlack = "text-black-50"
	FGHalfWhite = "text-white-50"

	BGPrimary     = "bg-primary"
	BGSecondary   = "bg-secondary"
	BGSuccess     = "bg-success"
	BGDanger      = "bg-danger"
	BGWarning     = "bg-warning"
	BGInfo        = "bg-info"
	BGLight       = "bg-light"
	BGDark        = "bg-dark"
	BGWhite       = "bg-white"
	BGTransparent = "bg-transparent"
)

pre-defined values.

Variables

This section is empty.

Functions

func Center

func Center(elm *dom.Element) *dom.Element

Center centers fixed-width element horizontally.

func Color

func Color(elm *dom.Element, color ...string) *dom.Element

Color adds foreground, backgroup or gradient colors to element.

func Float

func Float(elm *dom.Element, side string, vs ...string) *dom.Element

Float adds float style to element.

func Height

func Height(elm *dom.Element, size string) *dom.Element

Height adds height style to element.

func Margin

func Margin(elm *dom.Element, side string, size string, vs ...string) *dom.Element

Margin adds margin style to element.

func NegativeMargin

func NegativeMargin(elm *dom.Element, side string, size string, vs ...string) *dom.Element

NegativeMargin add negative margin style to element.

func Padding

func Padding(elm *dom.Element, side string, size string, vs ...string) *dom.Element

Padding add padding style to element.

func RemoveCenter

func RemoveCenter(elm *dom.Element) *dom.Element

RemoveCenter removes horizontally centering style from element.

func RemoveColor

func RemoveColor(elm *dom.Element, color ...string) *dom.Element

RemoveColor removes foreground, backgroup or gradient colors from element.

func RemoveFloat

func RemoveFloat(elm *dom.Element, side string, vs ...string) *dom.Element

RemoveFloat removes float style from element.

func RemoveHeight

func RemoveHeight(elm *dom.Element) *dom.Element

RemoveHeight removes height style.

func RemoveMargin

func RemoveMargin(elm *dom.Element, side string, size string, vs ...string) *dom.Element

RemoveMargin removes margin style from element.

func RemoveNegativeMargin

func RemoveNegativeMargin(elm *dom.Element, side string, size string, vs ...string) *dom.Element

RemoveNegativeMargin removes negative margin style from element.

func RemovePadding

func RemovePadding(elm *dom.Element, side string, size string, vs ...string) *dom.Element

RemovePadding removes paddind style from element.

func RemoveTextAlign

func RemoveTextAlign(elm *dom.Element, side string, vs ...string) *dom.Element

RemoveTextAlign removes text alignment style from element.

func RemoveVerticalAlign

func RemoveVerticalAlign(elm *dom.Element, side string) *dom.Element

RemoveVerticalAlign removes vertical alignment style to inline, inline-block, inline-table, and table cell elements.

func RemoveWidth

func RemoveWidth(elm *dom.Element) *dom.Element

RemoveWidth removes width style from element.

func TextAlign

func TextAlign(elm *dom.Element, side string, vs ...string) *dom.Element

TextAlign add text alignment style to element.

func VerticalAlign

func VerticalAlign(elm *dom.Element, side string) *dom.Element

VerticalAlign adds vertical alignment style to inline, inline-block, inline-table, and table cell elements.

func Width

func Width(elm *dom.Element, size string) *dom.Element

Width adds width style to element.

Types

type Component

type Component struct {
	*dom.Element
	// contains filtered or unexported fields
}

Component represents Bootstrap component.

func Attach

func Attach(id string) *Component

Attach binds some html component on page.

func ComponentOf

func ComponentOf(elm *dom.Element) *Component

ComponentOf returns a Bootstrap component.

func (*Component) Center

func (obj *Component) Center() *Component

Center centers fixed-width component horizontally.

func (*Component) Color

func (obj *Component) Color(color ...string) *Component

Color adds foreground, backgroup or gradient colors to component.

func (*Component) Float

func (obj *Component) Float(side string, vs ...string) *Component

Float adds float style to component.

func (*Component) Height

func (obj *Component) Height(size string) *Component

Height adds height style to component.

func (*Component) Hide

func (obj *Component) Hide() *Component

Hide add .invisible and remove .visible to hide component.

func (*Component) Margin

func (obj *Component) Margin(side string, size string, vs ...string) *Component

Margin adds margin style to component.

func (*Component) NegativeMargin

func (obj *Component) NegativeMargin(side string, size string, vs ...string) *Component

NegativeMargin add negative margin style to component.

func (*Component) On

func (obj *Component) On(event string, fn func(*js.Event))

On adds Bootstrap listener.

func (*Component) OnHide

func (obj *Component) OnHide(cb func(*Component))

OnHide add callback function when hiding.

func (*Component) OnShow

func (obj *Component) OnShow(cb func(*Component))

OnShow add callback function when showing.

func (*Component) Padding

func (obj *Component) Padding(side string, size string, vs ...string) *Component

Padding add padding style to component.

func (*Component) RemoveCenter

func (obj *Component) RemoveCenter() *Component

RemoveCenter removes horizontally centering style from component.

func (*Component) RemoveColor

func (obj *Component) RemoveColor(color ...string) *Component

RemoveColor removes foreground, backgroup or gradient colors from component.

func (*Component) RemoveFloat

func (obj *Component) RemoveFloat(side string, vs ...string) *Component

RemoveFloat removes float style from component.

func (*Component) RemoveHeight

func (obj *Component) RemoveHeight() *Component

RemoveHeight removes height style from component.

func (*Component) RemoveMargin

func (obj *Component) RemoveMargin(side string, size string, vs ...string) *Component

RemoveMargin removes margin style from component.

func (*Component) RemoveNegativeMargin

func (obj *Component) RemoveNegativeMargin(side string, size string, vs ...string) *Component

RemoveNegativeMargin removes negative margin style from component.

func (*Component) RemovePadding

func (obj *Component) RemovePadding(side string, size string, vs ...string) *Component

RemovePadding removes paddind style from component.

func (*Component) RemoveTextAlign

func (obj *Component) RemoveTextAlign(side string, vs ...string) *Component

RemoveTextAlign removes text alignment style from component.

func (*Component) RemoveVerticalAlign

func (obj *Component) RemoveVerticalAlign(side string) *Component

RemoveVerticalAlign removes vertical alignment style to inline, inline-block, inline-table, and table cell elements.

func (*Component) RemoveWidth

func (obj *Component) RemoveWidth() *Component

RemoveWidth removes width style from component.

func (*Component) Show

func (obj *Component) Show() *Component

Show add .visible and remove .invisible to show component.

func (*Component) TextAlign

func (obj *Component) TextAlign(side string, vs ...string) *Component

TextAlign add text alignment style to component.

func (*Component) VerticalAlign

func (obj *Component) VerticalAlign(side string) *Component

VerticalAlign adds vertical alignment style to inline, inline-block, inline-table, and table cell elements.

func (*Component) Width

func (obj *Component) Width(size string) *Component

Width adds width style to component.

type Style

type Style = string

Style represents Bootstrap component style like primary, secondary and etc.

const (
	Primary   Style = "primary"
	Secondary Style = "secondary"
	Success   Style = "success"
	Danger    Style = "danger"
	Warning   Style = "warning"
	Info      Style = "info"
	Light     Style = "light"
	Dark      Style = "dark"
)

pre-defined style.

Directories

Path Synopsis
Package alert wraps Bootstrap Alert component
Package alert wraps Bootstrap Alert component
Package badge wraps Bootstrap Badge component
Package badge wraps Bootstrap Badge component
Package button wraps Bootstrap Button component.
Package button wraps Bootstrap Button component.
Package card wraps Bootstrap Card component.
Package card wraps Bootstrap Card component.
Package list wraps Bootstrap List Group component.
Package list wraps Bootstrap List Group component.
Package modal wraps Bootstrap Modal component.
Package modal wraps Bootstrap Modal component.
Package progress wraps Bootstrap Progress component.
Package progress wraps Bootstrap Progress component.
Package spinner wraps Bootstrap spinner component.
Package spinner wraps Bootstrap spinner component.
Package table wraps Bootstrap default Table Content.
Package table wraps Bootstrap default Table Content.

Jump to

Keyboard shortcuts

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