Documentation
¶
Overview ¶
Package appshell provides a full-window application layout: an optional fixed header, navbar, aside and footer around a main content area that's automatically offset so it never sits under them.
Index ¶
- func Main(content elements.Element, st ...styles.Styles) elements.Element
- func New(cfg Config, st ...styles.Styles) elements.Element
- func Section(content func() elements.Element, st ...styles.Styles) elements.Element
- type Config
- type Slot
- func Aside(width int, content elements.Element, st ...styles.Styles) *Slot
- func Footer(height int, content elements.Element, st ...styles.Styles) *Slot
- func Header(height int, content elements.Element, st ...styles.Styles) *Slot
- func Navbar(width int, content elements.Element, st ...styles.Styles) *Slot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Main ¶
Main wraps content as an AppShell's main content area: it fills whatever space Header/Navbar/Aside/Footer leave once Config is resolved.
func New ¶
New returns a full-window layout: Header/Navbar/Aside/Footer (each optional) are fixed to their respective edges, and Main fills the remaining space, offset by whichever of them are present. The styles argument styles the root container; Width/Height default to -1 (fill the window).
Sizing Aside (flush right) and Footer (flush bottom) needs the window's own size, only known at layout time, so New defers building the actual child styles to a Raw element's Layout rather than computing them upfront - the usual approach elsewhere in the library (e.g. Right/Bottom-anchored Box children) only supports a nonzero offset from the far edge, since Go's int zero value can't distinguish "flush" from "not set" the way it can for Left/Top.
Types ¶
type Config ¶
Config configures an AppShell's optional slots. Header, Navbar, Aside and Footer are optional - leave nil to omit that slot - Main is the required content area, typically built with Main.
type Slot ¶
type Slot struct {
// contains filtered or unexported fields
}
Slot is a sized AppShell region: Header/Footer are height tall, Navbar/Aside are width wide. Build one with Header, Navbar, Aside or Footer.
func Aside ¶
Aside returns a Slot for Config.Aside: an aside width wide, spanning the height between Header and Footer (if present), fixed to the right (the left in a right-to-left locale).
func Footer ¶
Footer returns a Slot for Config.Footer: a footer height tall, spanning the full width, fixed to the bottom.