basic

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package basic is a library of the basic widgets.

Index

Constants

This section is empty.

Variables

View Source
var Any = factory.Any

Function aliases

View Source
var Bytes = factory.Bytes
View Source
var HTML = factory.HTML
View Source
var HTMLUnsafe = factory.HTMLUnsafe
View Source
var Many = factory.Many
View Source
var Tag = factory.Tag
View Source
var Text = factory.Text

Functions

This section is empty.

Types

type AlignWidget

type AlignWidget struct {
	*widget.WidgetBase[*AlignWidget]
	// contains filtered or unexported fields
}

AlignWidget renders a collection of widgets aligned to the left, right or center.

func (*AlignWidget) Add

func (wgt *AlignWidget) Add(children ...any) *AlignWidget

Add adds nested widgets.

func (*AlignWidget) Children

func (wgt *AlignWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*AlignWidget) Draw

func (wgt *AlignWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type AppBarWidget

type AppBarWidget struct {
	*widget.WidgetBase[*AppBarWidget]
	// contains filtered or unexported fields
}

AppBarWidget renders the top application bar.

func (*AppBarWidget) AddBottom

func (wgt *AppBarWidget) AddBottom(children ...any) *AppBarWidget

AddBottom adds nested widgets in the bottom section of the app bar.

func (*AppBarWidget) AddLeft

func (wgt *AppBarWidget) AddLeft(children ...any) *AppBarWidget

AddLeft adds nested widgets aligned to the left.

func (*AppBarWidget) AddRight

func (wgt *AppBarWidget) AddRight(children ...any) *AppBarWidget

AddRight adds nested widgets aligned to the right.

func (*AppBarWidget) Children

func (wgt *AppBarWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*AppBarWidget) Draw

func (wgt *AppBarWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*AppBarWidget) PageTitle

func (wgt *AppBarWidget) PageTitle() string

PageTitle returns the rendered text of the app bar's title heading, used by the enclosing page as its <title>.

func (*AppBarWidget) PageTitleMarker

func (wgt *AppBarWidget) PageTitleMarker()

PageTitleMarker is a framework hook that lets the enclosing page use the app bar's title as its <title>. App code should not need to call this.

func (wgt *AppBarWidget) WithBackLink(href string) *AppBarWidget

WithBackLink sets an explicit href for the back arrow. Without it, the back arrow falls back to the `_back` state variable. Accepts the full action-URL grammar (`?key=`, `^?…`, `/path`, etc.).

func (*AppBarWidget) WithHelpBubble

func (wgt *AppBarWidget) WithHelpBubble(helpChildren ...any) *AppBarWidget

WithHelpBubble sets help for the app bar.

func (wgt *AppBarWidget) WithHelpLink(href string) *AppBarWidget

WithHelpLink sets help for the app bar.

type AvatarWidget

type AvatarWidget struct {
	*widget.WidgetBase[*AvatarWidget]
	// contains filtered or unexported fields
}

AvatarWidget renders an avatar image.

func (*AvatarWidget) Draw

func (wgt *AvatarWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*AvatarWidget) WithNameLabel

func (wgt *AvatarWidget) WithNameLabel(show bool) *AvatarWidget

WithNameLabel displays the full name to the right of the avatar image. By default the name is not shown.

func (*AvatarWidget) WithSize

func (wgt *AvatarWidget) WithSize(ratio float32) *AvatarWidget

WithSize scales the avatar relative to its default size (1.0 = default, 2.0 = double). Values <= 0 are ignored.

type BannerImageWidget

type BannerImageWidget struct {
	*widget.WidgetBase[*BannerImageWidget]
	// contains filtered or unexported fields
}

BannerImageWidget renders a banner image.

func (*BannerImageWidget) Draw

func (wgt *BannerImageWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*BannerImageWidget) WithAltText

func (wgt *BannerImageWidget) WithAltText(altText string) *BannerImageWidget

WithAltText sets the alternate text of the image. This text is used by accessibility tools for the blind.

func (*BannerImageWidget) WithAnchorBottom

func (wgt *BannerImageWidget) WithAnchorBottom() *BannerImageWidget

WithAnchorBottom anchors the image to the bottom when the container is resized.

func (*BannerImageWidget) WithAnchorCenter

func (wgt *BannerImageWidget) WithAnchorCenter() *BannerImageWidget

WithAnchorCenter anchors the image to the center when the container is resized. This is the default.

func (*BannerImageWidget) WithAnchorTop

func (wgt *BannerImageWidget) WithAnchorTop() *BannerImageWidget

WithAnchorTop anchors the image to the top when the container is resized.

func (*BannerImageWidget) WithHeight

func (wgt *BannerImageWidget) WithHeight(css string) *BannerImageWidget

WithHeight scales the image to the given height. The width is always determined by the container; only the visible vertical slice changes. Pass any CSS length, e.g. "100px", "50%" or "calc(100vh - 50px)". Empty resets to the 100% default.

type BasicFactory

type BasicFactory struct{}

BasicFactory aggregates the widget constructors of this package. Use BasicFactory{} to construct a new factory

func (BasicFactory) AlignCenter

func (f BasicFactory) AlignCenter(children ...any) *AlignWidget

AlignCenter creates a new widget that renders a collection of widgets center-aligned.

func (BasicFactory) AlignLeft

func (f BasicFactory) AlignLeft(children ...any) *AlignWidget

AlignLeft creates a new widget that renders a collection of widgets aligned to the left.

func (BasicFactory) AlignRight

func (f BasicFactory) AlignRight(children ...any) *AlignWidget

AlignRight creates a new widget that renders a collection of widgets aligned to the right.

func (BasicFactory) AppBar

func (f BasicFactory) AppBar(titleChildren ...any) *AppBarWidget

AppBar creates a new widget that renders the top application bar. The title children are rendered as a HeadlineLarge; a back-arrow link is included by default and follows the `_back` state variable.

func (BasicFactory) Avatar

func (f BasicFactory) Avatar(name string, imageSrc string) *AvatarWidget

Avatar creates a new widget that renders an avatar. When imageSrc is empty, the avatar falls back to the user's initials (derived from the first and last name parts), or to a generic person icon if name is also empty.

func (BasicFactory) BannerImage

func (f BasicFactory) BannerImage(src string) *BannerImageWidget

BannerImage creates a new widget that renders an edge-to-edge image as a background within its container. Defaults: height 100% of the container, anchored center, no alt text.

func (BasicFactory) Block

func (f BasicFactory) Block(children ...any) *CollectionWidget

Block creates a new widget that wraps children in a block-level <div> with the standard bottom margin used for vertical rhythm between sections.

func (BasicFactory) CardElevated

func (f BasicFactory) CardElevated() *CardWidget

CardElevated creates a new widget that renders a Material elevated card (the default raised-surface style). A leading or trailing BannerImage child is rendered edge-to-edge above or below the card body.

func (BasicFactory) CardFilled

func (f BasicFactory) CardFilled() *CardWidget

CardFilled creates a new widget that renders a Material filled card. A leading or trailing BannerImage child is rendered edge-to-edge above or below the card body.

func (BasicFactory) CardOutlined

func (f BasicFactory) CardOutlined() *CardWidget

CardOutlined creates a new widget that renders a Material outlined card. A leading or trailing BannerImage child is rendered edge-to-edge above or below the card body.

func (BasicFactory) Code

func (f BasicFactory) Code(code string) *CodeWidget

Code creates a new widget that renders an inline <code> snippet. For multi-line blocks use PlainCodeBlock, or the code package's CodeBlock for syntax highlighting.

func (BasicFactory) Collection

func (f BasicFactory) Collection(children ...any) *CollectionWidget

Collection creates a new widget that wraps a group of widgets in an inline <span>. Use it to bundle siblings under a single redraw boundary or apply shared width/visibility. For a block-level wrapper with vertical rhythm, use Block.

func (BasicFactory) CopyToClipboard added in v0.1.2

func (f BasicFactory) CopyToClipboard(text string) *CopyToClipboardWidget

CopyToClipboard creates a new widget that renders a "content copy" icon. Clicking it writes the given text to the system clipboard and briefly swaps the icon to a check mark as feedback. The text is embedded in the rendered HTML, so prefer this widget for short-to-medium strings rather than large documents.

func (BasicFactory) Debugger

func (f BasicFactory) Debugger() *DebuggerWidget

Debugger creates a new widget that renders a floating in-page debug panel. The panel exposes the current state, request details, and partial-redraw activity — useful during development. Drop it from production pages.

func (BasicFactory) Deck

func (f BasicFactory) Deck(colsNarrow, colsWide, colsExpanded int) *DeckWidget

Deck creates a new widget that arranges its children into equal-width columns with an 8px gutter, choosing between three column counts based on the container's measured width: colsNarrow (<600px), colsWide (600–1200px), and colsExpanded (>1200px). A typical call is Deck(1, 2, 4).

func (BasicFactory) Embed

func (f BasicFactory) Embed(fetcher func() (res *http.Response, err error)) *EmbedWidget

Embed creates a new widget that splices the body of an HTTP response into the page. Only the content between <body> and </body> is inserted (or the whole response if those tags are absent). The fetcher is invoked every time the embed needs to render, including during partial redraws — keep it cheap or cache its result. For embedding an in-process handler, prefer EmbedHandler.

func (BasicFactory) EmbedHandler

func (f BasicFactory) EmbedHandler(handler http.HandlerFunc, original *http.Request, method string, url string, body io.ReadCloser) *EmbedWidget

EmbedHandler creates a new widget that embeds an in-process HTTP handler as a sub-page. The handler is called with a synthetic request: method, URL (resolved relative to original.URL), and body are supplied here; headers, context, and RemoteAddr are inherited from original. Pass your app's mux for handler so the embedded URL routes through the same middleware stack. Compressed responses (gzip / deflate / brotli) are transparently decoded before the <body> is extracted.

func (BasicFactory) Gallery

func (f BasicFactory) Gallery(children ...any) *GalleryWidget

Gallery creates a new widget that lays out its children as wrap-around tiles — typically images or cards. It renders nothing when empty.

func (BasicFactory) GroupingFrame

func (f BasicFactory) GroupingFrame(title string) *GroupingFrameWidget

GroupingFrame creates a new widget that renders a border around a grouping of widgets. The title is not shown if the grouping frame is nested right inside a tab switcher.

func (BasicFactory) HeadlineLarge

func (f BasicFactory) HeadlineLarge(children ...any) *HeadingWidget

HeadlineLarge creates a new widget that renders a H1 heading.

func (BasicFactory) HeadlineMedium

func (f BasicFactory) HeadlineMedium(children ...any) *HeadingWidget

HeadlineMedium creates a new widget that renders a H2 heading.

func (BasicFactory) HeadlineSmall

func (f BasicFactory) HeadlineSmall(children ...any) *HeadingWidget

HeadlineSmall creates a new widget that renders a H3 heading.

func (BasicFactory) HelpBubble

func (f BasicFactory) HelpBubble(children ...any) *InfoBubbleWidget

HelpBubble is identical to InfoBubble but uses a help (?) icon — use it for "what is this?" hints rather than informational notes.

func (f BasicFactory) HelpLink(href string) *InfoLinkWidget

HelpLink is identical to InfoLink but uses a help (?) icon — use it for "what is this?" links rather than informational ones.

func (BasicFactory) Icon

func (f BasicFactory) Icon(spec string) *IconWidget

Icon creates a new widget that renders an icon. The spec can be either a material symbol name or valid <svg></svg> markup.

Material symbol names are listed at https://fonts.google.com/icons?icon.set=Material+Symbols. Material symbols are a font and are therefore sized according to the current font size. See https://developers.google.com/fonts/docs/material_symbols for the developer's guide.

The SVG should not specify its own width or height so that it is rendered using the height of the current font size (i.e. 1em). The SVG should use the "currentColor" for fill and stroke colors to best fit with the color palette of the page.

func (BasicFactory) If

func (f BasicFactory) If(cond bool) *IfWidget

If creates a new widget that picks between Then/Else branches at build time based on cond. Note this is evaluated when the page is constructed, not on each redraw — for visibility that reacts to state changes use HideIf / HideIfEq / HideIfEmpty instead.

func (BasicFactory) Image

func (f BasicFactory) Image(src string) *ImageWidget

Image creates a new widget that renders an image.

func (BasicFactory) InfoBubble

func (f BasicFactory) InfoBubble(children ...any) *InfoBubbleWidget

InfoBubble creates a new widget that renders an info icon; hovering it reveals the nested children as a tooltip-style popover.

func (f BasicFactory) InfoLink(href string) *InfoLinkWidget

InfoLink creates a new widget that renders an info icon as a clickable link. The href accepts the full action-URL grammar (`?key=`, `^?…`, `/path`, etc.). For an in-page popover instead of a navigation, use InfoBubble.

func (f BasicFactory) Link(href string) *LinkWidget

Link creates a new widget that renders an anchor. href accepts the full action-URL grammar: `?key=val` (apply state), `^?…` (parent page), `~?…` (top page), `/path` (full navigation), `path` (relative to the page's data-location). An empty href, or one that resolves empty, causes the link to render nothing.

func (BasicFactory) Menu

func (f BasicFactory) Menu(title any) *MenuWidget

Menu creates a new widget that renders a popup menu opened by hovering or clicking the title. Items are added via Add and must be Link widgets so each action carries its own href.

func (BasicFactory) MenuEllipsisH

func (f BasicFactory) MenuEllipsisH() *MenuWidget

MenuEllipsisH creates a new widget that renders a popup menu with a horizontal ellipsis menu for its title.

func (BasicFactory) MenuEllipsisV

func (f BasicFactory) MenuEllipsisV() *MenuWidget

MenuEllipsisV creates a new widget that renders a popup menu with a vertical ellipsis menu for its title.

func (BasicFactory) MessageBar

func (f BasicFactory) MessageBar(children ...any) *MessageBarWidget

MessageBar creates a new widget that renders message bar in the primary color.

func (BasicFactory) MessageBarError

func (f BasicFactory) MessageBarError(children ...any) *MessageBarWidget

MessageBarError creates a new widget that renders message bar in the alert color (typically red).

func (BasicFactory) MobileHide

func (f BasicFactory) MobileHide(children ...any) *MobileWidget

MobileHide creates a new widget whose children are hidden on narrow (mobile-sized) viewports — the mirror of MobileOnly. Visibility is CSS-driven; the markup still ships to every client.

func (BasicFactory) MobileOnly

func (f BasicFactory) MobileOnly(children ...any) *MobileWidget

MobileOnly creates a new widget whose children are shown only on narrow (mobile-sized) viewports — useful for hamburger triggers or compact summaries that desktop layouts shouldn't display. Visibility is CSS-driven; the markup still ships to every client.

func (BasicFactory) Modal

func (f BasicFactory) Modal(name string) *ModalWidget

Modal creates a new widget that renders a modal window. The modal is bound to the named state variable: it opens when the variable is non-empty and closes when it is cleared. The typical pattern is to set the variable to the URL of an embedded handler and close with `^?name=` from inside the modal's content.

func (BasicFactory) PipeSeparator

func (f BasicFactory) PipeSeparator() *PipeSeparatorWidget

PipeSeparator creates a new widget that renders a vertical pipe ("|") between inline items, e.g. in a footer or breadcrumb.

func (BasicFactory) PlainCodeBlock

func (f BasicFactory) PlainCodeBlock(code ...any) *CodeWidget

PlainCodeBlock creates a new widget that renders a block of code with no syntax highlighting — just <pre><code> wrapping. For Chroma-driven syntax highlighting, use the code package's CodeBlock instead.

func (BasicFactory) Printf

func (f BasicFactory) Printf(format string, children ...any) *PrintfWidget

Printf creates a new widget that renders a collection of widgets formatted using a printf-like string. {n} appearing in the format string is replaced with the appropriate 0-indexed child. For example, "Lorem {0} ipsum {2} dolor sit amet {1}"

func (BasicFactory) Progress

func (f BasicFactory) Progress() *ProgressWidget

Progress creates a new widget that renders a progress bar. Set the maximum (WithMax) to make it visible. Combine WithValue for static progress, or WithRefreshURL for a live-updating bar that polls a JSON endpoint.

func (BasicFactory) Rule

func (f BasicFactory) Rule() *RuleWidget

Rule creates a new widget that renders a horizontal rule.

func (BasicFactory) ScriptInjector

func (f BasicFactory) ScriptInjector(src string) *ScriptInjectorWidget

ScriptInjector creates a new widget that appends a <script src=…> to document.head on first render. It deduplicates by src so reusing it across partial redraws is safe — the browser only loads the script once. No SRI or async/defer attributes are emitted; for tighter control inject your own <script> tag via Tag("script") or use AssetRegistry.RegisterIsolatedScript.

func (BasicFactory) SidePanel

func (f BasicFactory) SidePanel(name string) *SidePanelWidget

SidePanel creates a new widget that renders a floating side panel. Like Modal, the panel is bound to the named state variable: it opens when the variable is non-empty and closes when cleared. The typical pattern is to set the variable to the URL of an embedded handler and close with `^?name=` from inside the panel's content.

func (BasicFactory) Snackbar

func (f BasicFactory) Snackbar() *SnackbarWidget

Snackbar creates a new widget that renders a Material snackbar: a brief message that slides in, auto-dismisses, and pauses dismissal while hovered. Pair it with RedrawIfChanged on the state variable that drives the message so it appears in response to actions like saves or errors.

func (BasicFactory) Spacer

func (f BasicFactory) Spacer(lines float32) *SpacerWidget

Spacer creates a new widget that inserts vertical whitespace measured in 16-pixel "lines". Lines can be fractional or negative (negative pulls surrounding content closer together).

func (BasicFactory) SpacerBreak

func (f BasicFactory) SpacerBreak() *SpacerWidget

SpacerBreak creates a spacer with 0.5 lines of vertical space.

func (BasicFactory) SpacerNewLine

func (f BasicFactory) SpacerNewLine() *SpacerWidget

SpacerNewLine creates a spacer with 0 lines of vertical space.

func (BasicFactory) SpacerParagraph

func (f BasicFactory) SpacerParagraph() *SpacerWidget

SpacerParagraph creates a spacer with 1 lines of vertical space.

func (BasicFactory) Splitter

func (f BasicFactory) Splitter(widths ...int) *SplitterWidget

Splitter creates a new widget that lays out content in columns. Each width is a flex weight relative to the others; 0 means auto-size to the column's content. Empty columns are omitted entirely. Use AddLeft, AddRight, or AddToCol to populate columns. Splitter() with no widths is shorthand for a single auto-sized column.

func (BasicFactory) SuggestionChip

func (f BasicFactory) SuggestionChip(href string) *SuggestionChipWidget

SuggestionChip creates a new widget that renders a clickable Material suggestion chip. href accepts the full action-URL grammar. Group multiple chips inside a Gallery so they wrap nicely.

func (BasicFactory) Swatch

func (f BasicFactory) Swatch(color css.Color) *ColorSwatchWidget

Swatch creates a new widget that renders a small square filled with the given color. Useful in palettes, legends, and color-picker UIs.

func (BasicFactory) TabBody

func (f BasicFactory) TabBody(key string) *TabBodyWidget

TabBody creates a new widget for the content of one tab. key identifies the tab and must match a TabLabel's key within the same TabSwitcher. TabBody must be added directly to a TabSwitcher; rendering raises an error otherwise.

func (BasicFactory) TabLabel

func (f BasicFactory) TabLabel(key string) *TabLabelWidget

TabLabel creates a new widget that renders one clickable tab. key identifies the tab and must match a sibling TabBody's key within the same TabSwitcher. TabLabel must be added directly to a TabSwitcher. By default clicking the tab sets the switcher's state variable to key; override the target with WithHref.

func (BasicFactory) TabSwitcher

func (f BasicFactory) TabSwitcher() *TabSwitcherWidget

TabSwitcher creates a new widget that groups a row of TabLabels with their corresponding TabBodies (matched by key). The active tab is held in a state variable whose name defaults to "tab" — use WithName to disambiguate when there are multiple switchers on a page.

func (BasicFactory) TearOffCalendar

func (f BasicFactory) TearOffCalendar(date time.Time) *TearOffCalendarWidget

TearOffCalendar creates a new widget that renders a stylized date block showing month, day, and weekday — the look of a desk calendar page. A zero-value date renders nothing.

func (BasicFactory) TextAlignCenter

func (f BasicFactory) TextAlignCenter(children ...any) *TextAlignWidget

TextAlignCenter creates a new widget that renders a collection of widgets center-aligned.

func (BasicFactory) TextAlignLeft

func (f BasicFactory) TextAlignLeft(children ...any) *TextAlignWidget

TextAlignLeft creates a new widget that renders a collection of widgets aligned to the left.

func (BasicFactory) TextAlignRight

func (f BasicFactory) TextAlignRight(children ...any) *TextAlignWidget

TextAlignRight creates a new widget that renders a collection of widgets aligned to the right.

func (BasicFactory) TextBold

func (f BasicFactory) TextBold(children ...any) *TextStyleWidget

TextBold creates a new widget that alters the weight of the font to bold.

func (BasicFactory) TextLightweight

func (f BasicFactory) TextLightweight(children ...any) *TextStyleWidget

TextLightweight creates a new widget that alters the weight of the font to lightweight.

func (BasicFactory) TextStyle

func (f BasicFactory) TextStyle(children ...any) *TextStyleWidget

TextStyle creates a new widget that wraps children and lets you chain styling helpers (WithBold, WithItalic, WithColorPrimary, …). Each axis — color, weight, slant, size, monospace — is independent, but later calls on the same axis overwrite earlier ones (the last WithColor* wins, etc.). Color names come from the Material theme.

func (BasicFactory) TitleLarge

func (f BasicFactory) TitleLarge(children ...any) *HeadingWidget

TitleLarge creates a new widget that renders a H4 heading.

func (BasicFactory) TitleMedium

func (f BasicFactory) TitleMedium(children ...any) *HeadingWidget

TitleMedium creates a new widget that renders a H5 heading.

func (BasicFactory) TitleSmall

func (f BasicFactory) TitleSmall(children ...any) *HeadingWidget

TitleSmall creates a new widget that renders a H6 heading.

func (BasicFactory) Toolbar

func (f BasicFactory) Toolbar() *ToolbarWidget

Toolbar creates a new widget that renders a horizontal toolbar with two item groups — Add{Left,Right} populate them, and the right group is flush-right. Defaults: vertically centered, wraps onto multiple rows on narrow viewports.

func (BasicFactory) Underliner

func (f BasicFactory) Underliner(text string, terms string) *UnderlinerWidget

Underliner creates a new widget that renders text with any matches of the given search terms wrapped in <u>. terms is whitespace-split into individual words; matching is case-insensitive. Useful for highlighting the query in QuickSearch results — see also QuickSearchUnderliner.

type BytesWidget

type BytesWidget = widget.BytesWidget

type CardWidget

type CardWidget struct {
	*widget.WidgetBase[*CardWidget]
	// contains filtered or unexported fields
}

CardWidget renders a card.

func (*CardWidget) Add

func (wgt *CardWidget) Add(children ...any) *CardWidget

Add adds nested widgets.

func (*CardWidget) Children

func (wgt *CardWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*CardWidget) Draw

func (wgt *CardWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*CardWidget) WithDisabled

func (wgt *CardWidget) WithDisabled(disabled bool) *CardWidget

WithDisabled greys out the card and prevents the click from firing.

func (*CardWidget) WithHref

func (wgt *CardWidget) WithHref(href string) *CardWidget

WithHref makes the whole card clickable, navigating to href on click. Accepts the full action-URL grammar (`?key=`, `^?…`, `/path`, etc.).

func (*CardWidget) WithMinHeight

func (wgt *CardWidget) WithMinHeight(css string) *CardWidget

WithMinHeight sets the card's minimum height. Default is 240px; empty sizes to content instead. Pass any CSS length, e.g. "240px", "50%" or "calc(100vh - 50px)".

func (*CardWidget) WithTarget

func (wgt *CardWidget) WithTarget(target string) *CardWidget

WithTarget sets the HTML target for the card's link. Defaults to the page's `_target` state variable when unset.

type CodeWidget

type CodeWidget struct {
	*widget.WidgetBase[*CodeWidget]
	// contains filtered or unexported fields
}

CodeWidget renders code.

func (*CodeWidget) Add

func (wgt *CodeWidget) Add(children ...any) *CodeWidget

Add adds nested widgets.

func (*CodeWidget) Children

func (wgt *CodeWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*CodeWidget) Draw

func (wgt *CodeWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*CodeWidget) WithLanguage

func (wgt *CodeWidget) WithLanguage(language string) *CodeWidget

WithLanguage tags the code with a `language-<lang>` CSS class. It does not perform syntax highlighting on its own; use the code package for that.

type CollectionWidget

type CollectionWidget struct {
	*widget.WidgetBase[*CollectionWidget]
	// contains filtered or unexported fields
}

CollectionWidget renders a collection of widgets.

func (*CollectionWidget) Add

func (wgt *CollectionWidget) Add(children ...any) *CollectionWidget

Add adds nested widgets.

func (*CollectionWidget) Children

func (wgt *CollectionWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*CollectionWidget) Draw

func (wgt *CollectionWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*CollectionWidget) WithMaxWidth

func (wgt *CollectionWidget) WithMaxWidth(css string) *CollectionWidget

WithMaxWidth caps the width while allowing the content to be narrower. Empty clears it. Pass any CSS length, e.g. "400px", "80%" or "calc(100vw - 2em)".

func (*CollectionWidget) WithWidth

func (wgt *CollectionWidget) WithWidth(css string) *CollectionWidget

WithWidth sets an explicit width. Empty clears it. Pass any CSS length, e.g. "400px", "100%" or "calc(100vw - 2em)".

type ColorSwatchWidget

type ColorSwatchWidget struct {
	*widget.WidgetBase[*ColorSwatchWidget]
	// contains filtered or unexported fields
}

ColorSwatchWidget renders a swatch of color.

func (*ColorSwatchWidget) Draw

func (wgt *ColorSwatchWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type CopyToClipboardWidget added in v0.1.2

type CopyToClipboardWidget struct {
	*widget.WidgetBase[*CopyToClipboardWidget]
	// contains filtered or unexported fields
}

CopyToClipboardWidget renders a small icon button that writes a string to the system clipboard when clicked.

func (*CopyToClipboardWidget) Draw added in v0.1.2

func (wgt *CopyToClipboardWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*CopyToClipboardWidget) WithAltText added in v0.1.2

func (wgt *CopyToClipboardWidget) WithAltText(altText string) *CopyToClipboardWidget

WithAltText overrides the default "Copy to clipboard" label used for the hover tooltip and screen-reader announcement.

type DebuggerWidget

type DebuggerWidget struct {
	*widget.WidgetBase[*DebuggerWidget]
}

DebuggerWidget renders a debugger tool.

func (*DebuggerWidget) Draw

func (wgt *DebuggerWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type DeckWidget

type DeckWidget struct {
	*widget.WidgetBase[*DeckWidget]
	// contains filtered or unexported fields
}

DeckWidget renders a deck of cards.

func (*DeckWidget) Add

func (wgt *DeckWidget) Add(children ...any) *DeckWidget

Add adds nested widgets.

func (*DeckWidget) Children

func (wgt *DeckWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*DeckWidget) Draw

func (wgt *DeckWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type EmbedWidget

type EmbedWidget struct {
	*widget.WidgetBase[*EmbedWidget]
	// contains filtered or unexported fields
}

EmbedWidget renders an embedded page.

func (*EmbedWidget) Draw

func (wgt *EmbedWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*EmbedWidget) WithName

func (wgt *EmbedWidget) WithName(name string) *EmbedWidget

WithName names this embed as a frame. Links and forms elsewhere on the page can target this frame via the `target` attribute or the `_target` state variable, and the framework will route their responses here. A named empty embed renders an empty page placeholder so the frame remains a valid swap target.

type GalleryWidget

type GalleryWidget struct {
	*widget.WidgetBase[*GalleryWidget]
	// contains filtered or unexported fields
}

GalleryWidget renders a gallery.

func (*GalleryWidget) Add

func (wgt *GalleryWidget) Add(children ...any) *GalleryWidget

Add adds nested widgets.

func (*GalleryWidget) Children

func (wgt *GalleryWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*GalleryWidget) Draw

func (wgt *GalleryWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type GroupingFrameWidget

type GroupingFrameWidget struct {
	*widget.WidgetBase[*GroupingFrameWidget]
	// contains filtered or unexported fields
}

GroupingFrameWidget renders a border around a grouping of widgets.

func (*GroupingFrameWidget) Add

func (wgt *GroupingFrameWidget) Add(children ...any) *GroupingFrameWidget

Add adds nested widgets.

func (*GroupingFrameWidget) Children

func (wgt *GroupingFrameWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*GroupingFrameWidget) Draw

func (wgt *GroupingFrameWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type HeadingWidget

type HeadingWidget struct {
	*widget.WidgetBase[*HeadingWidget]
	// contains filtered or unexported fields
}

HeadingWidget renders a heading.

func (*HeadingWidget) Add

func (wgt *HeadingWidget) Add(children ...any) *HeadingWidget

Add adds nested widgets.

func (*HeadingWidget) Children

func (wgt *HeadingWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*HeadingWidget) Draw

func (wgt *HeadingWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type IconWidget

type IconWidget struct {
	*widget.WidgetBase[*IconWidget]
	// contains filtered or unexported fields
}

IconWidget renders an icon, either from the Material Symbols font or from inline SVG markup.

func (*IconWidget) Draw

func (wgt *IconWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

Accessibility: when alt text is provided, it is emitted as BOTH `title` (browser hover tooltip) and `aria-label` (screen-reader name). When no alt text is provided the icon is treated as decorative and hidden from assistive tech via `aria-hidden="true"` — appropriate when the icon sits inside an already-named control like a labelled button.

func (*IconWidget) WithAltText

func (wgt *IconWidget) WithAltText(altText string) *IconWidget

WithAltText labels the icon for screen readers and as the hover tooltip. Without alt text the icon is marked decorative (`aria-hidden`), which is usually right when it sits inside an already-labelled control.

func (*IconWidget) WithFill

func (wgt *IconWidget) WithFill(fill bool) *IconWidget

WithFill switches a Material Symbol from its default outlined style to its filled variant. Has no effect on SVG icons.

func (*IconWidget) WithSizeMultiplier

func (wgt *IconWidget) WithSizeMultiplier(size float32) *IconWidget

WithSizeMultiplier scales the icon relative to the surrounding font size (1.0 = match, 2.0 = double). Values <= 0 are ignored.

type IfWidget

type IfWidget struct {
	*widget.WidgetBase[*IfWidget]
	// contains filtered or unexported fields
}

IfWidget renders nested widgets based on a condition.

func (*IfWidget) Children

func (wgt *IfWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*IfWidget) Draw

func (wgt *IfWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*IfWidget) Else

func (wgt *IfWidget) Else(children ...any) *IfWidget

Else adds nested widgets to be rendered when the condition is false.

func (*IfWidget) Then

func (wgt *IfWidget) Then(children ...any) *IfWidget

Then adds nested widgets to be rendered when the condition is true.

type ImageWidget

type ImageWidget struct {
	*widget.WidgetBase[*ImageWidget]
	// contains filtered or unexported fields
}

ImageWidget renders an image.

func (*ImageWidget) Draw

func (wgt *ImageWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*ImageWidget) WithAltText

func (wgt *ImageWidget) WithAltText(altText string) *ImageWidget

WithAltText sets the alternate text of the image. This text is used by accessibility tools for the blind.

func (*ImageWidget) WithHeight

func (wgt *ImageWidget) WithHeight(css string) *ImageWidget

WithHeight scales the image to the given height. Unless explicitly set, the width is adjusted to maintain the aspect ratio. Allowed CSS units are "px", "%", "ch", "em", "vw", "vh", etc.

func (*ImageWidget) WithWidth

func (wgt *ImageWidget) WithWidth(css string) *ImageWidget

WithWidth scales the image to the given width. Unless explicitly set, the height is adjusted to maintain the aspect ratio. Allowed CSS units are "px", "%", "ch", "em", "vw", "vh", etc.

type InfoBubbleWidget

type InfoBubbleWidget struct {
	*widget.WidgetBase[*InfoBubbleWidget]
	// contains filtered or unexported fields
}

InfoBubbleWidget renders an info or help bubble.

func (*InfoBubbleWidget) Add

func (wgt *InfoBubbleWidget) Add(children ...any) *InfoBubbleWidget

Add adds nested widgets.

func (*InfoBubbleWidget) Children

func (wgt *InfoBubbleWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*InfoBubbleWidget) Draw

func (wgt *InfoBubbleWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type InfoLinkWidget

type InfoLinkWidget struct {
	*widget.WidgetBase[*InfoLinkWidget]
	// contains filtered or unexported fields
}

InfoLinkWidget renders an info or help link.

func (*InfoLinkWidget) Draw

func (wgt *InfoLinkWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*InfoLinkWidget) WithTarget

func (wgt *InfoLinkWidget) WithTarget(target string) *InfoLinkWidget

WithTarget sets the target of the link.

type InputWidget

type InputWidget = widget.InputWidget

type LinkWidget

type LinkWidget struct {
	*widget.WidgetBase[*LinkWidget]
	// contains filtered or unexported fields
}

LinkWidget renders a link.

func (*LinkWidget) Add

func (wgt *LinkWidget) Add(children ...any) *LinkWidget

Add adds nested widgets.

func (*LinkWidget) Children

func (wgt *LinkWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*LinkWidget) Draw

func (wgt *LinkWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*LinkWidget) WithDisabled

func (wgt *LinkWidget) WithDisabled(disabled bool) *LinkWidget

WithDisabled greys out the link and removes its anchor — the children still render but no navigation occurs.

func (*LinkWidget) WithHref

func (wgt *LinkWidget) WithHref(href string) *LinkWidget

WithHref replaces the link's href. Resets any prior WithHrefBack().

func (*LinkWidget) WithHrefBack

func (wgt *LinkWidget) WithHrefBack() *LinkWidget

WithHrefBack turns this into a "back" link. It follows the `_back` state variable when set; otherwise it falls back to a browser-history back step if the referrer is the same host. The link auto-hides when there's no history to go back to. Set `_back=0` to force-disable.

func (*LinkWidget) WithTarget

func (wgt *LinkWidget) WithTarget(target string) *LinkWidget

WithTarget sets the link's target. When unset, the page's `_target` state variable is used so the response routes into the active frame.

type MenuWidget struct {
	*widget.WidgetBase[*MenuWidget]
	// contains filtered or unexported fields
}

MenuWidget renders a popup menu.

func (wgt *MenuWidget) Add(actions ...*LinkWidget) *MenuWidget

Add appends menu items. Each item must be a Link — its href determines what the menu action does.

func (wgt *MenuWidget) Children() []Widget

Children are the widgets nested under this widget.

func (wgt *MenuWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type MessageBarWidget

type MessageBarWidget struct {
	*widget.WidgetBase[*MessageBarWidget]
	// contains filtered or unexported fields
}

MessageBarWidget renders a message bar.

func (*MessageBarWidget) Add

func (wgt *MessageBarWidget) Add(children ...any) *MessageBarWidget

Add adds nested widgets.

func (*MessageBarWidget) Children

func (wgt *MessageBarWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*MessageBarWidget) Draw

func (wgt *MessageBarWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type MobileWidget

type MobileWidget struct {
	*widget.WidgetBase[*MobileWidget]
	// contains filtered or unexported fields
}

MobileWidget renders its content to be visible or hidden depending on the screen size.

func (*MobileWidget) Add

func (wgt *MobileWidget) Add(children ...any) *MobileWidget

Add adds nested widgets.

func (*MobileWidget) Children

func (wgt *MobileWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*MobileWidget) Draw

func (wgt *MobileWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type ModalWidget

type ModalWidget struct {
	*widget.WidgetBase[*ModalWidget]
	// contains filtered or unexported fields
}

ModalWidget renders a modal window.

func (*ModalWidget) Add

func (wgt *ModalWidget) Add(children ...any) *ModalWidget

Add adds nested widgets.

func (*ModalWidget) Children

func (wgt *ModalWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*ModalWidget) Draw

func (wgt *ModalWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*ModalWidget) Drawn

func (wgt *ModalWidget) Drawn(r *http.Request) bool

Drawn indicates whether this widget needs to be drawn.

func (*ModalWidget) Embed

func (wgt *ModalWidget) Embed(fetcher func() (res *http.Response, err error)) *ModalWidget

Embed is shorthand for modal.Add(factory.Embed(fetcher)).

func (*ModalWidget) Shown

func (wgt *ModalWidget) Shown(r *http.Request) bool

Shown returns whether the widget is shown or hidden. A widget that is hidden is not rendered.

func (*ModalWidget) WithMinHeight

func (wgt *ModalWidget) WithMinHeight(css string) *ModalWidget

WithMinHeight sets the minimum height of the modal window. Pass any CSS length, e.g. "240px", "50%" or "calc(100vh - 50px)". The default is 240px. Empty adjusts the height to the content of the modal. In any case the modal will not span more than 90% of the height of the viewport.

func (*ModalWidget) WithWidth

func (wgt *ModalWidget) WithWidth(css string) *ModalWidget

WithWidth sets the width of the modal window. Pass any CSS length, e.g. "826px", "90%" or "calc(100vw - 2em)". Empty clears it. The default is 826px which fits 800px content internally. In any case the modal will not span more than 90% of the width of the viewport.

type PipeSeparatorWidget

type PipeSeparatorWidget struct {
	*widget.WidgetBase[*PipeSeparatorWidget]
}

PipeSeparatorWidget renders a vertical pipe separator.

func (*PipeSeparatorWidget) Draw

func (wgt *PipeSeparatorWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type PrintfWidget

type PrintfWidget struct {
	*widget.WidgetBase[*PrintfWidget]
	// contains filtered or unexported fields
}

PrintfWidget renders a collection of widgets formatted using a printf-like string.

func (*PrintfWidget) Add

func (wgt *PrintfWidget) Add(children ...any) *PrintfWidget

Add adds nested widgets.

func (*PrintfWidget) Children

func (wgt *PrintfWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*PrintfWidget) Draw

func (wgt *PrintfWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type ProgressWidget

type ProgressWidget struct {
	*widget.WidgetBase[*ProgressWidget]
	// contains filtered or unexported fields
}

ProgressWidget renders a progress bar.

func (*ProgressWidget) Draw

func (wgt *ProgressWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*ProgressWidget) WithHeight

func (wgt *ProgressWidget) WithHeight(css string) *ProgressWidget

WithHeight sets the height of the progress bar. Pass any CSS length, e.g. "8px", "1em". Empty clears it.

func (*ProgressWidget) WithMax

func (wgt *ProgressWidget) WithMax(max int) *ProgressWidget

WithMax sets the bar's maximum. The bar is hidden until this is set to a positive value (the default is 0). Negative values are ignored.

func (*ProgressWidget) WithRefreshInterval

func (wgt *ProgressWidget) WithRefreshInterval(interval time.Duration) *ProgressWidget

WithRefreshInterval sets the polling cadence for the refresh URL. Default is 250ms. Non-positive values are ignored.

func (*ProgressWidget) WithRefreshURL

func (wgt *ProgressWidget) WithRefreshURL(refreshURL string) *ProgressWidget

WithRefreshURL sets a remote resource that updates a dynamic progress bar. The response is expected in the form of a JSON object in the form:

{
	"value": 123,			// A negative value results in an infinite progress bar
	"stop": true,			// Once stopped, a dynamic progress bar will no longer refresh
	"action": "?done=1",	// An action URL to call
}

func (*ProgressWidget) WithValue

func (wgt *ProgressWidget) WithValue(value int) *ProgressWidget

WithValue sets the bar's current value (clamped to 0..max by the browser). Pass a negative value to render an indeterminate / "infinite" progress animation instead.

func (*ProgressWidget) WithWidth

func (wgt *ProgressWidget) WithWidth(css string) *ProgressWidget

WithWidth sets the width of the progress bar. Pass any CSS length, e.g. "200px", "100%" or "calc(100% - 1em)". Empty clears it.

type RuleWidget

type RuleWidget struct {
	*widget.WidgetBase[*RuleWidget]
}

RuleWidget renders a horizontal rule.

func (*RuleWidget) Draw

func (wgt *RuleWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type ScriptInjectorWidget

type ScriptInjectorWidget struct {
	*widget.WidgetBase[*ScriptInjectorWidget]
	// contains filtered or unexported fields
}

ScriptInjectorWidget injects a script to the head of the page.

func (*ScriptInjectorWidget) Draw

func (wgt *ScriptInjectorWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type SidePanelWidget

type SidePanelWidget struct {
	*widget.WidgetBase[*SidePanelWidget]
	// contains filtered or unexported fields
}

SidePanelWidget renders a floating side panel.

func (*SidePanelWidget) Add

func (wgt *SidePanelWidget) Add(children ...any) *SidePanelWidget

Add adds nested widgets.

func (*SidePanelWidget) Children

func (wgt *SidePanelWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*SidePanelWidget) Draw

func (wgt *SidePanelWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*SidePanelWidget) Drawn

func (wgt *SidePanelWidget) Drawn(r *http.Request) bool

Drawn indicates whether this widget needs to be drawn.

func (*SidePanelWidget) Shown

func (wgt *SidePanelWidget) Shown(r *http.Request) bool

Shown returns whether the widget is shown or hidden. A widget that is hidden is not rendered.

func (*SidePanelWidget) WithWidth

func (wgt *SidePanelWidget) WithWidth(css string) *SidePanelWidget

WithWidth sets the width of the side panel. Default is 400px. Pass any CSS length, e.g. "400px", "50%" or "calc(100vh - 50px)". Empty clears it. The panel is capped at 90% of the viewport width regardless.

type SnackbarWidget

type SnackbarWidget struct {
	*widget.WidgetBase[*SnackbarWidget]
	// contains filtered or unexported fields
}

SnackbarWidget renders a transient toast notification.

func (*SnackbarWidget) Add

func (wgt *SnackbarWidget) Add(children ...any) *SnackbarWidget

Add adds nested widgets.

func (*SnackbarWidget) Children

func (wgt *SnackbarWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*SnackbarWidget) Draw

func (wgt *SnackbarWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type SpacerWidget

type SpacerWidget struct {
	*widget.WidgetBase[*SpacerWidget]
	// contains filtered or unexported fields
}

SpacerWidget renders a vertical space.

func (*SpacerWidget) Draw

func (wgt *SpacerWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type SplitterWidget

type SplitterWidget struct {
	*widget.WidgetBase[*SplitterWidget]
	// contains filtered or unexported fields
}

SplitterWidget renders content in columns.

func (*SplitterWidget) AddLeft

func (wgt *SplitterWidget) AddLeft(leftChildren ...any) *SplitterWidget

AddLeft adds nested widgets to the leftmost column.

func (*SplitterWidget) AddRight

func (wgt *SplitterWidget) AddRight(rightChildren ...any) *SplitterWidget

AddRight adds nested widgets to the rightmost column.

func (*SplitterWidget) AddToCol

func (wgt *SplitterWidget) AddToCol(index int, children ...any) *SplitterWidget

AddToCol adds nested widgets to the 0-indexed column.

func (*SplitterWidget) Children

func (wgt *SplitterWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*SplitterWidget) Draw

func (wgt *SplitterWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*SplitterWidget) WithWrap

func (wgt *SplitterWidget) WithWrap(wrap bool) *SplitterWidget

WithWrap controls whether the splitter stacks columns vertically on narrow (<600px) viewports. When wrapped, columns stack in declaration order: left → middle → … → right. Default is true.

type SuggestionChipWidget

type SuggestionChipWidget struct {
	*widget.WidgetBase[*SuggestionChipWidget]
	// contains filtered or unexported fields
}

SuggestionChipWidget renders a suggestion chip.

func (*SuggestionChipWidget) Add

func (wgt *SuggestionChipWidget) Add(children ...any) *SuggestionChipWidget

Add adds nested widgets.

func (*SuggestionChipWidget) Children

func (wgt *SuggestionChipWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*SuggestionChipWidget) Draw

func (wgt *SuggestionChipWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*SuggestionChipWidget) WithDisabled

func (wgt *SuggestionChipWidget) WithDisabled(disabled bool) *SuggestionChipWidget

WithDisabled disables the suggestion chip.

func (*SuggestionChipWidget) WithHref

func (wgt *SuggestionChipWidget) WithHref(href string) *SuggestionChipWidget

WithHRef sets the URL of the suggestion chip.

func (*SuggestionChipWidget) WithTarget

func (wgt *SuggestionChipWidget) WithTarget(target string) *SuggestionChipWidget

WithTarget sets the target of the suggestion chip.

type TabBodyWidget

type TabBodyWidget struct {
	*widget.WidgetBase[*TabBodyWidget]
	// contains filtered or unexported fields
}

TabBodyWidget renders a tab.

func (*TabBodyWidget) Add

func (wgt *TabBodyWidget) Add(children ...any) *TabBodyWidget

Add adds nested widgets to the body.

func (*TabBodyWidget) Children

func (wgt *TabBodyWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*TabBodyWidget) Draw

func (wgt *TabBodyWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*TabBodyWidget) Drawn

func (wgt *TabBodyWidget) Drawn(r *http.Request) bool

Drawn indicates whether this widget needs to be drawn.

func (*TabBodyWidget) Shown

func (wgt *TabBodyWidget) Shown(r *http.Request) bool

Shown returns whether the widget is shown or hidden. A widget that is hidden is not rendered.

type TabLabelWidget

type TabLabelWidget struct {
	*widget.WidgetBase[*TabLabelWidget]
	// contains filtered or unexported fields
}

TabLabelWidget renders a tab.

func (*TabLabelWidget) Add

func (wgt *TabLabelWidget) Add(children ...any) *TabLabelWidget

Add adds nested widgets to the label.

func (*TabLabelWidget) Children

func (wgt *TabLabelWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*TabLabelWidget) Draw

func (wgt *TabLabelWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*TabLabelWidget) Drawn

func (wgt *TabLabelWidget) Drawn(r *http.Request) bool

Drawn indicates whether this widget needs to be drawn.

func (*TabLabelWidget) WithHref

func (wgt *TabLabelWidget) WithHref(href string) *TabLabelWidget

WithHref overrides the tab's default action with an explicit href. Use this to point a tab at another page instead of just selecting itself in the current switcher. Accepts the full action-URL grammar.

type TabSwitcherWidget

type TabSwitcherWidget struct {
	*widget.WidgetBase[*TabSwitcherWidget]
	// contains filtered or unexported fields
}

TabSwitcherWidget renders a tab switcher.

func (*TabSwitcherWidget) AddLeft

func (wgt *TabSwitcherWidget) AddLeft(children ...any) *TabSwitcherWidget

AddLeft places TabLabels into the left side of the tab strip and queues their TabBodies. Non-tab children are silently discarded.

func (*TabSwitcherWidget) AddRight

func (wgt *TabSwitcherWidget) AddRight(children ...any) *TabSwitcherWidget

AddRight places TabLabels into the right side of the tab strip and queues their TabBodies. Non-tab children are silently discarded.

func (*TabSwitcherWidget) Children

func (wgt *TabSwitcherWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*TabSwitcherWidget) Draw

func (wgt *TabSwitcherWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*TabSwitcherWidget) WithDynamic

func (wgt *TabSwitcherWidget) WithDynamic(dynamic bool) *TabSwitcherWidget

WithDynamic switches the tab switcher to server-side rendering: only the active tab's body is sent, and switching tabs triggers a partial redraw. Default is false — all tabs are rendered up-front and switched on the client. Turn this on when individual tabs are expensive to render or contain data that must reflect a tab change.

func (*TabSwitcherWidget) WithLine

func (wgt *TabSwitcherWidget) WithLine(line bool) *TabSwitcherWidget

WithLine indicates if to draw a line below the tab labels. The default behavior is to draw a line.

func (*TabSwitcherWidget) WithName

func (wgt *TabSwitcherWidget) WithName(name string) *TabSwitcherWidget

WithName sets the state variable that holds the active tab key. Multiple tab switchers on the same page must use distinct names so they don't fight over the same key. Default is "tab".

func (*TabSwitcherWidget) WithSelected

func (wgt *TabSwitcherWidget) WithSelected(tabKey string) *TabSwitcherWidget

WithSelected sets the tab to show on first render. Overridden once the user clicks a tab and the state variable is set. Defaults to the first label/body added.

type TearOffCalendarWidget

type TearOffCalendarWidget struct {
	*widget.WidgetBase[*TearOffCalendarWidget]
	// contains filtered or unexported fields
}

TearOffCalendarWidget renders a tear-off calendar with month, day and weekday.

func (*TearOffCalendarWidget) Children

func (wgt *TearOffCalendarWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*TearOffCalendarWidget) Draw

func (wgt *TearOffCalendarWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type TextAlignWidget

type TextAlignWidget struct {
	*widget.WidgetBase[*TextAlignWidget]
	// contains filtered or unexported fields
}

TextAlignWidget aligns text content via CSS text-align. For aligning block-level children (cards, buttons, etc.) horizontally as a group, use AlignLeft/Center/Right instead.

func (*TextAlignWidget) Add

func (wgt *TextAlignWidget) Add(children ...any) *TextAlignWidget

Add adds nested widgets.

func (*TextAlignWidget) Children

func (wgt *TextAlignWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*TextAlignWidget) Draw

func (wgt *TextAlignWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

type TextStyleWidget

type TextStyleWidget struct {
	*widget.WidgetBase[*TextStyleWidget]
	// contains filtered or unexported fields
}

TextStyleWidget alters the appearance of text.

func (*TextStyleWidget) Add

func (wgt *TextStyleWidget) Add(children ...any) *TextStyleWidget

Add adds nested widgets.

func (*TextStyleWidget) ApplyIf

func (wgt *TextStyleWidget) ApplyIf(condition bool) *TextStyleWidget

ApplyIf gates all styling on a condition: when false, the wrapper renders its children with no styling applied at all (size, color, weight, etc. are dropped). Useful for "bold the active row" patterns.

func (*TextStyleWidget) Children

func (wgt *TextStyleWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*TextStyleWidget) Draw

func (wgt *TextStyleWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*TextStyleWidget) WithBold

func (wgt *TextStyleWidget) WithBold() *TextStyleWidget

WithBold changes the weight of the font to bold.

func (*TextStyleWidget) WithColorDeemphasized

func (wgt *TextStyleWidget) WithColorDeemphasized() *TextStyleWidget

WithColorDeemphasized changes the color of the text to the deemphasized color.

func (*TextStyleWidget) WithColorDefault

func (wgt *TextStyleWidget) WithColorDefault() *TextStyleWidget

WithColorDefault changes the color of the text to the default color.

func (*TextStyleWidget) WithColorDisabled

func (wgt *TextStyleWidget) WithColorDisabled() *TextStyleWidget

WithColorDisabled changes the color of the text to the disabled text color.

func (*TextStyleWidget) WithColorError

func (wgt *TextStyleWidget) WithColorError() *TextStyleWidget

WithColorError changes the color of the text to the error color.

func (*TextStyleWidget) WithColorInverse

func (wgt *TextStyleWidget) WithColorInverse() *TextStyleWidget

WithColorInverse swaps to the inverse surface colors — used for content that should stand out against the normal page background.

func (*TextStyleWidget) WithColorOK

func (wgt *TextStyleWidget) WithColorOK() *TextStyleWidget

WithColorOK changes the text color to the OK / success color (typically green).

func (*TextStyleWidget) WithColorOnError

func (wgt *TextStyleWidget) WithColorOnError() *TextStyleWidget

WithColorOnError is the legible pairing for content rendered on top of the error color.

func (*TextStyleWidget) WithColorOnOK

func (wgt *TextStyleWidget) WithColorOnOK() *TextStyleWidget

WithColorOnOK is the legible pairing for content rendered on top of the OK / success color.

func (*TextStyleWidget) WithColorOnPrimary

func (wgt *TextStyleWidget) WithColorOnPrimary() *TextStyleWidget

WithColorOnPrimary sets text and background to read legibly when placed over the primary color — i.e. the "on-primary" pairing in M3.

func (*TextStyleWidget) WithColorOnSecondary

func (wgt *TextStyleWidget) WithColorOnSecondary() *TextStyleWidget

WithColorOnSecondary is the legible pairing for content rendered on top of the secondary color.

func (*TextStyleWidget) WithColorOnTertiary

func (wgt *TextStyleWidget) WithColorOnTertiary() *TextStyleWidget

WithColorOnTertiary is the legible pairing for content rendered on top of the tertiary color.

func (*TextStyleWidget) WithColorPrimary

func (wgt *TextStyleWidget) WithColorPrimary() *TextStyleWidget

WithColorPrimary changes the color of the text to the primary color.

func (*TextStyleWidget) WithColorSecondary

func (wgt *TextStyleWidget) WithColorSecondary() *TextStyleWidget

WithColorSecondary changes the color of the text to the secondary color.

func (*TextStyleWidget) WithColorTertiary

func (wgt *TextStyleWidget) WithColorTertiary() *TextStyleWidget

WithColorTertiary changes the color of the text to the tertiary color.

func (*TextStyleWidget) WithItalic

func (wgt *TextStyleWidget) WithItalic() *TextStyleWidget

WithItalic changes the slant of the font to italic.

func (*TextStyleWidget) WithLightweight

func (wgt *TextStyleWidget) WithLightweight() *TextStyleWidget

WithLightweight changes the weight of the font to lightweight.

func (*TextStyleWidget) WithMonospace

func (wgt *TextStyleWidget) WithMonospace() *TextStyleWidget

WithMonospace changes the font to a monospace font.

func (*TextStyleWidget) WithSize

func (wgt *TextStyleWidget) WithSize(size float32, unit string) *TextStyleWidget

WithSize sets the size of the font. Allowed CSS units are "px", "%", "ch", "em", "vw", "vh", etc.

func (*TextStyleWidget) WithSizeMultiplier

func (wgt *TextStyleWidget) WithSizeMultiplier(multiplier float32) *TextStyleWidget

WithSizeMultiplier is shorthand for setting the size with em unit.

type ToolbarWidget

type ToolbarWidget struct {
	*widget.WidgetBase[*ToolbarWidget]
	// contains filtered or unexported fields
}

ToolbarWidget renders a toolbar.

func (*ToolbarWidget) AddLeft

func (wgt *ToolbarWidget) AddLeft(leftChildren ...any) *ToolbarWidget

AddLeft adds nested widgets aligned to the left.

func (*ToolbarWidget) AddRight

func (wgt *ToolbarWidget) AddRight(rightChildren ...any) *ToolbarWidget

AddRight adds nested widgets aligned to the right.

func (*ToolbarWidget) Children

func (wgt *ToolbarWidget) Children() []Widget

Children are the widgets nested under this widget.

func (*ToolbarWidget) Draw

func (wgt *ToolbarWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*ToolbarWidget) WithAlignBottom

func (wgt *ToolbarWidget) WithAlignBottom() *ToolbarWidget

WithAlignBottom aligns the toolbar widgets to the bottom of the toolbar.

func (*ToolbarWidget) WithAlignCenter

func (wgt *ToolbarWidget) WithAlignCenter() *ToolbarWidget

WithAlignCenter centers the toolbar widgets vertically. This is the default behavior.

func (*ToolbarWidget) WithAlignTop

func (wgt *ToolbarWidget) WithAlignTop() *ToolbarWidget

WithAlignTop aligns the toolbar widgets to the top.

func (*ToolbarWidget) WithWrap

func (wgt *ToolbarWidget) WithWrap(wrap bool) *ToolbarWidget

WithWrap controls whether the toolbar wraps onto multiple rows on narrow viewports. When wrapped, the left group appears above the right group. Default is true.

type UnderlinerWidget

type UnderlinerWidget struct {
	*widget.WidgetBase[*UnderlinerWidget]
	// contains filtered or unexported fields
}

UnderlinerWidget underlines search terms in a text.

func (*UnderlinerWidget) Draw

func (wgt *UnderlinerWidget) Draw(w io.Writer, r *http.Request) (err error)

Draw renders the widget's HTML.

func (*UnderlinerWidget) WithPrefixOnly

func (wgt *UnderlinerWidget) WithPrefixOnly(prefix bool) *UnderlinerWidget

WithPrefixOnly restricts matching to word prefixes. When false (default), a term matches anywhere within a word. Word boundaries are runs of whitespace.

type Widget

type Widget = widget.Widget

Type aliases

Jump to

Keyboard shortcuts

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