bootstrap

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: EUPL-1.2 Imports: 9 Imported by: 0

Documentation

Overview

Package bootstrap provides a design system contrib app using Bootstrap 5, Bootstrap Icons, and htmx. It embeds static assets and provides HTML layouts that can be used as the default layout for all pages. The layout is injected via middleware only when no other layout is already set in the request context.

The app ships three color themes (blue, purple, gray) selectable via WithColor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Layout

func Layout() string

Layout returns the template name for the base bootstrap layout (no navbar).

func NavLayout() string

NavLayout returns the template name for the bootstrap layout with navbar slot.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App implements a design system contrib app providing Bootstrap CSS/JS and htmx.

func New

func New(opts ...Option) *App

New creates a new bootstrap design app with the given options.

func (*App) Dependencies

func (a *App) Dependencies() []string

func (*App) Middleware

func (a *App) Middleware() []func(http.Handler) http.Handler

Middleware returns middleware that injects the bootstrap layout into the request context when no layout is already set.

func (*App) Name

func (a *App) Name() string

func (*App) Register

func (a *App) Register(cfg *burrow.AppConfig) error

func (*App) StaticFS

func (a *App) StaticFS() (string, fs.FS)

StaticFS returns the embedded static assets under the "bootstrap" prefix.

func (*App) TemplateFS

func (a *App) TemplateFS() fs.FS

TemplateFS returns the embedded HTML template files with the CSS link template generated from the configured color theme.

type Color added in v0.6.0

type Color string

Color represents a Bootstrap color theme.

const (
	Default Color = ""
	Blue    Color = "blue"
	Purple  Color = "purple"
	Gray    Color = "gray"
)

type Option added in v0.6.0

type Option func(*App)

Option configures the bootstrap app.

func WithColor added in v0.6.0

func WithColor(c Color) Option

WithColor sets the color theme. Default is Purple.

func WithCustomCSS added in v0.6.0

func WithCustomCSS(path string) Option

WithCustomCSS sets a custom CSS file path (relative to staticfiles). This overrides WithColor. The CSS file must be served by the staticfiles app — either embedded in your app's static FS or in a contrib app.

bootstrap.New(bootstrap.WithCustomCSS("myapp/mytheme.min.css"))

Jump to

Keyboard shortcuts

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