Documentation
¶
Overview ¶
Package ui provides a server-rendered UI framework where Go builds typed DOM node trees that compile to pure JavaScript strings. The browser receives raw JS that performs document.createElement calls directly -- no HTML, no JSON intermediate, no client-side framework.
SVG elements (svg, path, circle, rect, etc.) are automatically created with document.createElementNS using the SVG namespace. Child elements of an SVG root inherit the namespace. Classes on SVG elements use setAttribute('class', ...) instead of .className for compatibility.
Index ¶
- Constants
- func AddClass(id, cls string) string
- func Download(filename, mimeType, base64Data string) string
- func DragToScroll(id string) string
- func Hide(id string) string
- func Notify(variant, message string) string
- func Redirect(url string) string
- func RemoveClass(id, cls string) string
- func RemoveEl(id string) string
- func SetAttr(id, attr, value string) string
- func SetLocation(url string) string
- func SetText(id, text string) string
- func SetTitle(title string) string
- func Show(id string) string
- func Target() string
- type AccordionBuilder
- func (a *AccordionBuilder) AccordionClass(cls string) *AccordionBuilder
- func (a *AccordionBuilder) Build() *Node
- func (a *AccordionBuilder) Item(title string, content *Node, open ...bool) *AccordionBuilder
- func (a *AccordionBuilder) Multiple(m bool) *AccordionBuilder
- func (a *AccordionBuilder) Variant(v string) *AccordionBuilder
- type Action
- type ActionHandler
- type AlertBuilder
- func (a *AlertBuilder) AlertClass(cls string) *AlertBuilder
- func (a *AlertBuilder) Build() *Node
- func (a *AlertBuilder) Dismissible(d bool) *AlertBuilder
- func (a *AlertBuilder) Message(m string) *AlertBuilder
- func (a *AlertBuilder) Persist(key string) *AlertBuilder
- func (a *AlertBuilder) Title(t string) *AlertBuilder
- func (a *AlertBuilder) Variant(v string) *AlertBuilder
- type App
- func (app *App) Action(name string, handler ActionHandler)
- func (app *App) Assets(fsys fs.FS, dir, prefix string)
- func (app *App) Broadcast(js string)
- func (app *App) CSS(urls []string, css string)
- func (app *App) DELETE(path string, handler http.HandlerFunc)
- func (app *App) GET(path string, handler http.HandlerFunc)
- func (app *App) Handler() http.Handler
- func (app *App) Layout(handler LayoutHandler)
- func (app *App) Listen(addr string) error
- func (app *App) POST(path string, handler http.HandlerFunc)
- func (app *App) Page(path string, handler PageHandler)
- type BadgeBuilder
- func (b *BadgeBuilder) BadgeClass(cls string) *BadgeBuilder
- func (b *BadgeBuilder) BadgeIcon(name string) *BadgeBuilder
- func (b *BadgeBuilder) BadgeSize(s string) *BadgeBuilder
- func (b *BadgeBuilder) Build() *Node
- func (b *BadgeBuilder) Color(c string) *BadgeBuilder
- func (b *BadgeBuilder) Dot() *BadgeBuilder
- func (b *BadgeBuilder) Square() *BadgeBuilder
- type ButtonBuilder
- func (b *ButtonBuilder) BtnClass(cls string) *ButtonBuilder
- func (b *ButtonBuilder) BtnColor(c string) *ButtonBuilder
- func (b *ButtonBuilder) BtnIcon(name string) *ButtonBuilder
- func (b *ButtonBuilder) BtnSize(s string) *ButtonBuilder
- func (b *ButtonBuilder) Build() *Node
- func (b *ButtonBuilder) Disabled(d bool) *ButtonBuilder
- func (b *ButtonBuilder) Href(url string) *ButtonBuilder
- func (b *ButtonBuilder) OnBtnClick(a *Action) *ButtonBuilder
- func (b *ButtonBuilder) Reset() *ButtonBuilder
- func (b *ButtonBuilder) Submit(formID ...string) *ButtonBuilder
- type CaptchaV3Builder
- type CardBuilder
- func (c *CardBuilder) Build() *Node
- func (c *CardBuilder) CardBody(n *Node) *CardBuilder
- func (c *CardBuilder) CardClass(cls string) *CardBuilder
- func (c *CardBuilder) CardCompact(cp bool) *CardBuilder
- func (c *CardBuilder) CardFooter(n *Node) *CardBuilder
- func (c *CardBuilder) CardHeader(n *Node) *CardBuilder
- func (c *CardBuilder) CardHover(h bool) *CardBuilder
- func (c *CardBuilder) CardImage(src, alt string) *CardBuilder
- func (c *CardBuilder) CardImagePriority(p bool) *CardBuilder
- func (c *CardBuilder) CardImageSize(width, height string) *CardBuilder
- func (c *CardBuilder) CardPadding(p string) *CardBuilder
- func (c *CardBuilder) CardVariant(v string) *CardBuilder
- type ColOpt
- type Collate
- func (c *Collate[T]) Action(name string) *Collate[T]
- func (c *Collate[T]) BodyID() string
- func (c *Collate[T]) CollateClass(cls string) *Collate[T]
- func (c *Collate[T]) Detail(fn func(*T) *Node) *Collate[T]
- func (c *Collate[T]) Empty(text string) *Collate[T]
- func (c *Collate[T]) EmptyIcon(icon string) *Collate[T]
- func (c *Collate[T]) Filter(fields ...CollateFilterField) *Collate[T]
- func (c *Collate[T]) FooterID() string
- func (c *Collate[T]) HasMore(more bool) *Collate[T]
- func (c *Collate[T]) Limit(n int) *Collate[T]
- func (c *Collate[T]) Locale(l *CollateLocale) *Collate[T]
- func (c *Collate[T]) Order(order string) *Collate[T]
- func (c *Collate[T]) Page(p int) *Collate[T]
- func (c *Collate[T]) Render(data []*T) *Node
- func (c *Collate[T]) RenderFooter() *Node
- func (c *Collate[T]) RenderRows(data []*T) []*Node
- func (c *Collate[T]) Row(fn func(*T, int) *Node) *Collate[T]
- func (c *Collate[T]) RowOffset(offset int) *Collate[T]
- func (c *Collate[T]) Search(val string) *Collate[T]
- func (c *Collate[T]) SetFilter(field string, val *CollateFilterValue) *Collate[T]
- func (c *Collate[T]) Sort(fields ...CollateSortField) *Collate[T]
- func (c *Collate[T]) TotalItems(n int) *Collate[T]
- type CollateFilterField
- type CollateFilterType
- type CollateFilterValue
- type CollateLocale
- type CollateOption
- type CollateSortField
- type ColumnFilter
- type ConfirmLocale
- type ConfirmOpt
- type Context
- type DataTable
- func (dt *DataTable[T]) Action(actionName string) *DataTable[T]
- func (dt *DataTable[T]) Col(label string, opt ColOpt[T]) *DataTable[T]
- func (dt *DataTable[T]) DataTableClass(cls string) *DataTable[T]
- func (dt *DataTable[T]) Detail(fn func(*T) *Node) *DataTable[T]
- func (dt *DataTable[T]) Empty(text string) *DataTable[T]
- func (dt *DataTable[T]) Field(fn func(*T) *Node, cls ...string) *DataTable[T]
- func (dt *DataTable[T]) FieldText(fn func(*T) string, cls ...string) *DataTable[T]
- func (dt *DataTable[T]) FilterDate(colIdx int, label string) *DataTable[T]
- func (dt *DataTable[T]) FilterNumber(colIdx int, label string) *DataTable[T]
- func (dt *DataTable[T]) FilterSelect(colIdx int, label string, options []string) *DataTable[T]
- func (dt *DataTable[T]) FilterText(colIdx int, label string) *DataTable[T]
- func (dt *DataTable[T]) FooterID() string
- func (dt *DataTable[T]) HasMore(more bool) *DataTable[T]
- func (dt *DataTable[T]) Head(label string, cls ...string) *DataTable[T]
- func (dt *DataTable[T]) HeadHTML(label string, cls ...string) *DataTable[T]
- func (dt *DataTable[T]) Locale(l *TableLocale) *DataTable[T]
- func (dt *DataTable[T]) Page(page int) *DataTable[T]
- func (dt *DataTable[T]) PageSize(size int) *DataTable[T]
- func (dt *DataTable[T]) Render(data []*T) *Node
- func (dt *DataTable[T]) RenderFooter() *Node
- func (dt *DataTable[T]) RenderRows(data []*T) []*Node
- func (dt *DataTable[T]) RowOffset(offset int) *DataTable[T]
- func (dt *DataTable[T]) Search(val string) *DataTable[T]
- func (dt *DataTable[T]) SetFilterLabels(badges []FilterBadge) *DataTable[T]
- func (dt *DataTable[T]) SetFilterValue(colIdx int, value *FilterValue) *DataTable[T]
- func (dt *DataTable[T]) Sort(col int, dir string) *DataTable[T]
- func (dt *DataTable[T]) Sortable(columns ...int) *DataTable[T]
- func (dt *DataTable[T]) TableClass(cls string) *DataTable[T]
- func (dt *DataTable[T]) TbodyID() string
- func (dt *DataTable[T]) TotalItems(count int) *DataTable[T]
- func (dt *DataTable[T]) TotalPages(total int) *DataTable[T]
- type DropdownBuilder
- func (d *DropdownBuilder) Build() *Node
- func (d *DropdownBuilder) DropdownClass(cls string) *DropdownBuilder
- func (d *DropdownBuilder) DropdownDanger(label string, action *Action, icon ...string) *DropdownBuilder
- func (d *DropdownBuilder) DropdownDivider() *DropdownBuilder
- func (d *DropdownBuilder) DropdownHeader(label string) *DropdownBuilder
- func (d *DropdownBuilder) DropdownItem(label string, action *Action, icon ...string) *DropdownBuilder
- func (d *DropdownBuilder) DropdownPosition(p string) *DropdownBuilder
- type Field
- type FieldBuilder
- func (fb *FieldBuilder) Class(cls string) *FieldBuilder
- func (fb *FieldBuilder) Err(msg string) *FieldBuilder
- func (fb *FieldBuilder) IsChecked(c bool) *FieldBuilder
- func (fb *FieldBuilder) Opts(pairs ...string) *FieldBuilder
- func (fb *FieldBuilder) PatternValidation(p string) *FieldBuilder
- func (fb *FieldBuilder) Placeholder(p string) *FieldBuilder
- func (fb *FieldBuilder) Render() *FormBuilder
- func (fb *FieldBuilder) Required() *FieldBuilder
- func (fb *FieldBuilder) Value(v string) *FieldBuilder
- func (fb *FieldBuilder) WrapClass(cls string) *FieldBuilder
- type FieldOption
- type FieldType
- type FilterBadge
- type FilterLocale
- type FilterOperator
- type FilterType
- type FilterValue
- type FormBuilder
- func (f *FormBuilder) Action(name string) *FormBuilder
- func (f *FormBuilder) Area(label, name string) *FieldBuilder
- func (f *FormBuilder) Build() *Node
- func (f *FormBuilder) Checkbox(label, name string) *FieldBuilder
- func (f *FormBuilder) DateField(label, name string) *FieldBuilder
- func (f *FormBuilder) DatetimeField(label, name string) *FieldBuilder
- func (f *FormBuilder) Email(label, name string) *FieldBuilder
- func (f *FormBuilder) ErrClass(cls string) *FormBuilder
- func (f *FormBuilder) FormClass(cls string) *FormBuilder
- func (f *FormBuilder) Hidden(name string) *FieldBuilder
- func (f *FormBuilder) InputClass(cls string) *FormBuilder
- func (f *FormBuilder) Number(label, name string) *FieldBuilder
- func (f *FormBuilder) Password(label, name string) *FieldBuilder
- func (f *FormBuilder) Phone(label, name string) *FieldBuilder
- func (f *FormBuilder) Radio(label, name string) *FieldBuilder
- func (f *FormBuilder) RadioBtn(label, name string) *FieldBuilder
- func (f *FormBuilder) RadioCard(label, name string) *FieldBuilder
- func (f *FormBuilder) SearchField(label, name string) *FieldBuilder
- func (f *FormBuilder) SelectField(label, name string) *FieldBuilder
- func (f *FormBuilder) Submit(action, label, class string) *FormBuilder
- func (f *FormBuilder) Text(label, name string) *FieldBuilder
- func (f *FormBuilder) TimeField(label, name string) *FieldBuilder
- func (f *FormBuilder) UrlField(label, name string) *FieldBuilder
- func (f *FormBuilder) Validate(data map[string]any) FormErrors
- type FormErrors
- type LayoutHandler
- type Node
- func A(class ...string) *Node
- func Abbr(class ...string) *Node
- func Article(class ...string) *Node
- func Aside(class ...string) *Node
- func Audio(class ...string) *Node
- func B(class ...string) *Node
- func Blockquote(class ...string) *Node
- func Br() *Node
- func Button(class ...string) *Node
- func Canvas(class ...string) *Node
- func Caption(class ...string) *Node
- func Code(class ...string) *Node
- func Col(class ...string) *Node
- func Colgroup(class ...string) *Node
- func ConfirmDialog(title, message string, confirmAction *Action, opts ...ConfirmOpt) *Node
- func Datalist(class ...string) *Node
- func Dd(class ...string) *Node
- func Details(class ...string) *Node
- func Dialog(class ...string) *Node
- func Div(class ...string) *Node
- func Dl(class ...string) *Node
- func Dt(class ...string) *Node
- func El(tag string, class ...string) *Node
- func Em(class ...string) *Node
- func Embed(class ...string) *Node
- func Fieldset(class ...string) *Node
- func Figcaption(class ...string) *Node
- func Figure(class ...string) *Node
- func FilterPopup(colIdx int, colLabel string, filterType FilterType, options []string, ...) *Node
- func Footer(class ...string) *Node
- func Form(class ...string) *Node
- func H1(class ...string) *Node
- func H2(class ...string) *Node
- func H3(class ...string) *Node
- func H4(class ...string) *Node
- func H5(class ...string) *Node
- func H6(class ...string) *Node
- func Header(class ...string) *Node
- func Hr() *Node
- func I(class ...string) *Node
- func IArea(class ...string) *Node
- func ICheckbox(class ...string) *Node
- func IColor(class ...string) *Node
- func IDate(class ...string) *Node
- func IDatetime(class ...string) *Node
- func IEmail(class ...string) *Node
- func IFile(class ...string) *Node
- func IHidden(class ...string) *Node
- func INumber(class ...string) *Node
- func IPassword(class ...string) *Node
- func IPhone(class ...string) *Node
- func IRadio(class ...string) *Node
- func IRange(class ...string) *Node
- func IReset(class ...string) *Node
- func ISearch(class ...string) *Node
- func ISubmit(class ...string) *Node
- func IText(class ...string) *Node
- func ITime(class ...string) *Node
- func IUrl(class ...string) *Node
- func Icon(name string, class ...string) *Node
- func IconText(icon, text string, class ...string) *Node
- func If(cond bool, node *Node) *Node
- func Iframe(class ...string) *Node
- func Img(class ...string) *Node
- func Input(class ...string) *Node
- func Label(class ...string) *Node
- func Legend(class ...string) *Node
- func Li(class ...string) *Node
- func Link() *Node
- func Main(class ...string) *Node
- func Map[T any](items []T, fn func(T, int) *Node) []*Node
- func Mark(class ...string) *Node
- func Markdown(class, content string) *Node
- func Meta() *Node
- func Meter(class ...string) *Node
- func Nav(class ...string) *Node
- func Object(class ...string) *Node
- func Ol(class ...string) *Node
- func Optgroup(class ...string) *Node
- func Option(class ...string) *Node
- func Or(cond bool, yes, no *Node) *Node
- func Output(class ...string) *Node
- func P(class ...string) *Node
- func Picture(class ...string) *Node
- func Pre(class ...string) *Node
- func Progress(class ...string) *Node
- func SVG(class ...string) *Node
- func Section(class ...string) *Node
- func Select(class ...string) *Node
- func SkeletonCards() *Node
- func SkeletonComponent() *Node
- func SkeletonForm() *Node
- func SkeletonList() *Node
- func SkeletonPage() *Node
- func SkeletonTable() *Node
- func Small(class ...string) *Node
- func Source(class ...string) *Node
- func Span(class ...string) *Node
- func Strong(class ...string) *Node
- func Sub(class ...string) *Node
- func Summary(class ...string) *Node
- func Sup(class ...string) *Node
- func Table(class ...string) *Node
- func Tbody(class ...string) *Node
- func Td(class ...string) *Node
- func Textarea(class ...string) *Node
- func Tfoot(class ...string) *Node
- func Th(class ...string) *Node
- func Thead(class ...string) *Node
- func ThemeSwitcher(opts ...ThemeSwitcherOpt) *Node
- func Time(class ...string) *Node
- func Tr(class ...string) *Node
- func U(class ...string) *Node
- func Ul(class ...string) *Node
- func Video(class ...string) *Node
- func Wbr() *Node
- func (n *Node) Attr(key, val string) *Node
- func (n *Node) Class(cls string) *Node
- func (n *Node) ID(id string) *Node
- func (n *Node) JS(raw string) *Node
- func (n *Node) On(event string, action *Action) *Node
- func (n *Node) OnClick(action *Action) *Node
- func (n *Node) OnSubmit(action *Action) *Node
- func (n *Node) Render(children ...*Node) *Node
- func (n *Node) Style(key, val string) *Node
- func (n *Node) Text(t string) *Node
- func (n *Node) ToJS() string
- func (n *Node) ToJSAppend(parentID string) string
- func (n *Node) ToJSInner(targetID string) string
- func (n *Node) ToJSPrepend(parentID string) string
- func (n *Node) ToJSReplace(targetID string) string
- type PageHandler
- type ProgressBuilder
- func (p *ProgressBuilder) Animated(a bool) *ProgressBuilder
- func (p *ProgressBuilder) Build() *Node
- func (p *ProgressBuilder) Indeterminate(i bool) *ProgressBuilder
- func (p *ProgressBuilder) LabelPosition(pos string) *ProgressBuilder
- func (p *ProgressBuilder) ProgressClass(cls string) *ProgressBuilder
- func (p *ProgressBuilder) ProgressColor(c string) *ProgressBuilder
- func (p *ProgressBuilder) ProgressGradient(colors ...string) *ProgressBuilder
- func (p *ProgressBuilder) ProgressLabel(l string) *ProgressBuilder
- func (p *ProgressBuilder) ProgressSize(s string) *ProgressBuilder
- func (p *ProgressBuilder) ProgressValue(v int) *ProgressBuilder
- func (p *ProgressBuilder) Striped(s bool) *ProgressBuilder
- type RadioStyle
- type Response
- func (r *Response) Add(js string) *Response
- func (r *Response) Append(parentID string, node *Node) *Response
- func (r *Response) Back() *Response
- func (r *Response) Build() string
- func (r *Response) Inner(targetID string, node *Node) *Response
- func (r *Response) Navigate(url string) *Response
- func (r *Response) Remove(id string) *Response
- func (r *Response) Replace(targetID string, node *Node) *Response
- func (r *Response) Toast(variant, message string) *Response
- type SimpleTable
- type StepProgressBuilder
- func (s *StepProgressBuilder) Build() *Node
- func (s *StepProgressBuilder) Locale(l *StepProgressLocale) *StepProgressBuilder
- func (s *StepProgressBuilder) StepClass(cls string) *StepProgressBuilder
- func (s *StepProgressBuilder) StepColor(c string) *StepProgressBuilder
- func (s *StepProgressBuilder) StepSize(sz string) *StepProgressBuilder
- type StepProgressLocale
- type TableLocale
- type TabsBuilder
- type ThemeSwitcherLocale
- type ThemeSwitcherOpt
- type TooltipBuilder
- func (t *TooltipBuilder) Delay(ms int) *TooltipBuilder
- func (t *TooltipBuilder) TooltipClass(cls string) *TooltipBuilder
- func (t *TooltipBuilder) TooltipPosition(p string) *TooltipBuilder
- func (t *TooltipBuilder) TooltipVariant(v string) *TooltipBuilder
- func (t *TooltipBuilder) Wrap(trigger *Node) *Node
Constants ¶
const ( BtnBlue = "bg-blue-600 hover:bg-blue-700 text-white" BtnRed = "bg-red-600 hover:bg-red-700 text-white" BtnGreen = "bg-green-600 hover:bg-green-700 text-white" BtnYellow = "bg-yellow-500 hover:bg-yellow-600 text-gray-900" BtnPurple = "bg-purple-600 hover:bg-purple-700 text-white" BtnGray = "bg-gray-600 hover:bg-gray-700 text-white" BtnWhite = "" /* 142-byte string literal not displayed */ BtnBlueOutline = "" /* 131-byte string literal not displayed */ BtnRedOutline = "bg-transparent hover:bg-red-50 text-red-600 border border-red-600 dark:hover:bg-red-950 dark:text-red-400 dark:border-red-500" BtnGreenOutline = "" /* 137-byte string literal not displayed */ )
Button color presets.
const ( BtnXS = "px-2 py-1 text-xs" BtnSM = "px-3 py-1.5 text-sm" BtnMD = "px-4 py-2 text-sm" BtnLG = "px-5 py-2.5 text-base" BtnXL = "px-6 py-3 text-lg" )
Button size presets.
const ( RadioInline = FieldRadio RadioButton = FieldRadioBtn RadioCard = FieldRadioCard )
Variables ¶
This section is empty.
Functions ¶
func DragToScroll ¶ added in v1.1.0
DragToScroll returns JS that enables mouse-drag horizontal scrolling on the element with the given ID. Interactive children (input, select, button, a, .dt-filter-dropdown) are excluded from triggering the drag.
func Notify ¶ added in v1.1.0
Notify returns JS that shows a toast notification styled with a left accent border, colored dot, and auto-dismiss. Supports "success", "error", "error-reload" (persistent with Reload button), and "info" (default) variants.
func RemoveClass ¶ added in v1.1.0
RemoveClass returns JS that removes a CSS class from an element.
func SetLocation ¶ added in v1.1.0
SetLocation returns JS that updates the browser URL without a page reload using history.pushState. Use this in WS actions to keep the address bar in sync with the visible content.
Types ¶
type AccordionBuilder ¶ added in v1.1.0
type AccordionBuilder struct {
// contains filtered or unexported fields
}
AccordionBuilder builds an accordion component using native <details>/<summary>.
func NewAccordion ¶ added in v1.1.0
func NewAccordion() *AccordionBuilder
NewAccordion creates a new AccordionBuilder with default "bordered" variant.
func (*AccordionBuilder) AccordionClass ¶ added in v1.1.0
func (a *AccordionBuilder) AccordionClass(cls string) *AccordionBuilder
AccordionClass sets additional CSS classes on the accordion wrapper.
func (*AccordionBuilder) Build ¶ added in v1.1.0
func (a *AccordionBuilder) Build() *Node
Build produces the complete accordion Node tree.
func (*AccordionBuilder) Item ¶ added in v1.1.0
func (a *AccordionBuilder) Item(title string, content *Node, open ...bool) *AccordionBuilder
Item adds an accordion item. The optional open parameter controls whether the item starts expanded (defaults to false).
func (*AccordionBuilder) Multiple ¶ added in v1.1.0
func (a *AccordionBuilder) Multiple(m bool) *AccordionBuilder
Multiple controls whether multiple items can be open simultaneously. When false (default), opening one item closes others.
func (*AccordionBuilder) Variant ¶ added in v1.1.0
func (a *AccordionBuilder) Variant(v string) *AccordionBuilder
Variant sets the visual style: "bordered" (default), "ghost", or "separated".
type Action ¶
type Action struct {
Name string // e.g. "counter.increment"
Data map[string]any // state payload sent with the call
Collect []string // element IDs whose .value to collect before calling
// contains filtered or unexported fields
}
Action describes a server-side handler invoked via WebSocket, or a client-side JS snippet when created via JS().
type ActionHandler ¶ added in v1.1.0
ActionHandler processes a WS action call and returns a JS string to execute on the client.
type AlertBuilder ¶ added in v1.1.0
type AlertBuilder struct {
// contains filtered or unexported fields
}
AlertBuilder configures a styled alert/notification banner.
func NewAlert ¶ added in v1.1.0
func NewAlert() *AlertBuilder
NewAlert creates a new AlertBuilder with "info" variant.
func (*AlertBuilder) AlertClass ¶ added in v1.1.0
func (a *AlertBuilder) AlertClass(cls string) *AlertBuilder
AlertClass sets additional CSS classes on the alert container.
func (*AlertBuilder) Build ¶ added in v1.1.0
func (a *AlertBuilder) Build() *Node
Build produces the alert Node tree.
func (*AlertBuilder) Dismissible ¶ added in v1.1.0
func (a *AlertBuilder) Dismissible(d bool) *AlertBuilder
Dismissible enables a close button on the alert.
func (*AlertBuilder) Message ¶ added in v1.1.0
func (a *AlertBuilder) Message(m string) *AlertBuilder
Message sets the alert body text.
func (*AlertBuilder) Persist ¶ added in v1.1.0
func (a *AlertBuilder) Persist(key string) *AlertBuilder
Persist sets a localStorage key. When dismissed, the alert stays hidden on subsequent page loads until the key is cleared.
func (*AlertBuilder) Title ¶ added in v1.1.0
func (a *AlertBuilder) Title(t string) *AlertBuilder
Title sets the alert heading.
func (*AlertBuilder) Variant ¶ added in v1.1.0
func (a *AlertBuilder) Variant(v string) *AlertBuilder
Variant sets the visual variant: "info", "success", "warning", "error", or any of those with a "-outline" suffix for bordered style.
type App ¶
type App struct {
// Favicon is the URL path for the site favicon (e.g. "/assets/favicon.svg").
// When set, a <link rel="icon"> tag is emitted in the HTML shell.
Favicon string
// Title sets the <title> element in the HTML shell.
// Improves accessibility (screen readers) and SEO.
Title string
// Description sets the <meta name="description"> content in the HTML shell.
// Used by search engines to summarize page content.
Description string
// HTMLHead contains raw HTML strings injected into the <head> section
// after the built-in Tailwind/Material Icons/WS script tags.
// Each entry is emitted as-is (e.g. "<style>body{margin:0}</style>",
// "<script src=\"...\"></script>", "<link ...>").
HTMLHead []string
// contains filtered or unexported fields
}
App is the top-level application container. It holds page routes (GET) and named actions (WS). Pages return a *Node tree that compiles to JS for the initial render. Actions return raw JS strings for DOM mutations.
func (*App) Action ¶
func (app *App) Action(name string, handler ActionHandler)
Action registers a named server action callable via WebSocket. The handler receives a Context (with .Body() for payload) and returns a raw JS string that the client executes directly.
func (*App) Assets ¶
Assets serves static files from an embedded or on-disk filesystem. The dir is stripped from fsys (via fs.Sub) and the result is served under the given URL prefix. Example:
//go:embed assets/* var assets embed.FS app.Assets(assets, "assets", "/assets/")
This makes assets/favicon.svg available at /assets/favicon.svg.
func (*App) Broadcast ¶ added in v1.1.1
Broadcast sends a JS string to ALL connected WebSocket clients. Can be called from anywhere (background goroutines, HTTP handlers, etc.) without needing a Context.
func (*App) CSS ¶ added in v1.1.3
CSS registers external stylesheets and/or inline CSS rules that apply to every page in the application. The tags are injected into the HTML <head> server-side, so they load immediately without JavaScript.
app.CSS(
[]string{"https://fonts.googleapis.com/css2?family=Oswald&display=swap"},
`body { font-family: 'Oswald', sans-serif; }`,
)
Pass nil for urls if you only need inline CSS, or "" for css if you only need external links.
func (*App) DELETE ¶ added in v0.111.8
func (app *App) DELETE(path string, handler http.HandlerFunc)
DELETE registers a standard HTTP DELETE handler on the internal mux.
func (*App) GET ¶ added in v0.111.8
func (app *App) GET(path string, handler http.HandlerFunc)
GET registers a standard HTTP GET handler on the internal mux. Use this for REST API endpoints that return JSON, files, etc.
func (*App) Handler ¶ added in v0.111.8
Handler sets up routes and returns the internal http.Handler (mux). Use this when you need a custom http.Server for graceful shutdown, TLS, etc.
srv := &http.Server{Addr: ":8080", Handler: app.Handler()}
srv.ListenAndServe()
func (*App) Layout ¶
func (app *App) Layout(handler LayoutHandler)
Layout registers a layout handler that wraps every page render. The handler returns a *Node tree that must contain exactly one element with ID("__content__"). The page handler's output is injected there.
func (*App) POST ¶ added in v0.111.8
func (app *App) POST(path string, handler http.HandlerFunc)
POST registers a standard HTTP POST handler on the internal mux.
func (*App) Page ¶
func (app *App) Page(path string, handler PageHandler)
Page registers a GET route. The handler returns a *Node tree which is compiled to JS and served inside a minimal HTML shell.
type BadgeBuilder ¶ added in v1.1.0
type BadgeBuilder struct {
// contains filtered or unexported fields
}
BadgeBuilder configures an inline badge / pill label.
func NewBadge ¶ added in v1.1.0
func NewBadge(text string) *BadgeBuilder
NewBadge creates a new BadgeBuilder with the given text.
func (*BadgeBuilder) BadgeClass ¶ added in v1.1.0
func (b *BadgeBuilder) BadgeClass(cls string) *BadgeBuilder
BadgeClass sets additional CSS classes on the badge.
func (*BadgeBuilder) BadgeIcon ¶ added in v1.1.0
func (b *BadgeBuilder) BadgeIcon(name string) *BadgeBuilder
BadgeIcon sets a Material icon name to prepend inside the badge.
func (*BadgeBuilder) BadgeSize ¶ added in v1.1.0
func (b *BadgeBuilder) BadgeSize(s string) *BadgeBuilder
BadgeSize sets the badge size: "sm", "md" (default), or "lg".
func (*BadgeBuilder) Build ¶ added in v1.1.0
func (b *BadgeBuilder) Build() *Node
Build produces the badge Node.
func (*BadgeBuilder) Color ¶ added in v1.1.0
func (b *BadgeBuilder) Color(c string) *BadgeBuilder
Color sets the color scheme. Supports: "gray", "red", "green", "blue", "yellow", "purple", each optionally with "-outline" or "-soft" suffix.
func (*BadgeBuilder) Dot ¶ added in v1.1.0
func (b *BadgeBuilder) Dot() *BadgeBuilder
Dot renders a small dot indicator instead of text content.
func (*BadgeBuilder) Square ¶ added in v1.1.0
func (b *BadgeBuilder) Square() *BadgeBuilder
Square uses rounded-md corners instead of fully rounded (pill shape).
type ButtonBuilder ¶ added in v1.1.0
type ButtonBuilder struct {
// contains filtered or unexported fields
}
ButtonBuilder configures a high-level button component.
func NewButton ¶ added in v1.1.0
func NewButton(label string) *ButtonBuilder
NewButton creates a new ButtonBuilder with the given label. Defaults to BtnBlue color and BtnMD size.
func (*ButtonBuilder) BtnClass ¶ added in v1.1.0
func (b *ButtonBuilder) BtnClass(cls string) *ButtonBuilder
BtnClass sets additional CSS classes on the button element.
func (*ButtonBuilder) BtnColor ¶ added in v1.1.0
func (b *ButtonBuilder) BtnColor(c string) *ButtonBuilder
BtnColor sets the button color preset (use Btn* constants or custom classes).
func (*ButtonBuilder) BtnIcon ¶ added in v1.1.0
func (b *ButtonBuilder) BtnIcon(name string) *ButtonBuilder
BtnIcon sets a Material icon name to display before the label.
func (*ButtonBuilder) BtnSize ¶ added in v1.1.0
func (b *ButtonBuilder) BtnSize(s string) *ButtonBuilder
BtnSize sets the button size preset (use Btn* size constants or custom classes).
func (*ButtonBuilder) Build ¶ added in v1.1.0
func (b *ButtonBuilder) Build() *Node
Build produces the button Node.
func (*ButtonBuilder) Disabled ¶ added in v1.1.0
func (b *ButtonBuilder) Disabled(d bool) *ButtonBuilder
Disabled marks the button as visually and functionally disabled.
func (*ButtonBuilder) Href ¶ added in v1.1.0
func (b *ButtonBuilder) Href(url string) *ButtonBuilder
Href converts the button to an <a> tag linking to the given URL.
func (*ButtonBuilder) OnBtnClick ¶ added in v1.1.0
func (b *ButtonBuilder) OnBtnClick(a *Action) *ButtonBuilder
OnBtnClick sets the action to execute when the button is clicked.
func (*ButtonBuilder) Reset ¶ added in v1.1.0
func (b *ButtonBuilder) Reset() *ButtonBuilder
Reset makes the button a reset button.
func (*ButtonBuilder) Submit ¶ added in v1.1.0
func (b *ButtonBuilder) Submit(formID ...string) *ButtonBuilder
Submit makes the button a submit button. Optionally pass a form ID.
type CaptchaV3Builder ¶ added in v1.1.0
type CaptchaV3Builder struct {
// contains filtered or unexported fields
}
CaptchaV3Builder configures a reCAPTCHA v3 widget that loads the Google script, executes the challenge, and stores the token in a hidden input.
func NewCaptchaV3 ¶ added in v1.1.0
func NewCaptchaV3(siteKey string) *CaptchaV3Builder
NewCaptchaV3 creates a new reCAPTCHA v3 builder with the given site key.
func (*CaptchaV3Builder) Build ¶ added in v1.1.0
func (c *CaptchaV3Builder) Build() *Node
Build produces the Node tree: a container with a hidden input for the token and JS that loads the reCAPTCHA v3 script, executes the challenge, and auto-refreshes the token every 110 seconds.
func (*CaptchaV3Builder) FormAction ¶ added in v1.1.0
func (c *CaptchaV3Builder) FormAction(name string) *CaptchaV3Builder
FormAction sets the action name sent to reCAPTCHA for scoring context.
func (*CaptchaV3Builder) TokenField ¶ added in v1.1.0
func (c *CaptchaV3Builder) TokenField(name string) *CaptchaV3Builder
TokenField sets the hidden input name where the token will be stored. Defaults to "g-recaptcha-response".
type CardBuilder ¶ added in v1.1.0
type CardBuilder struct {
// contains filtered or unexported fields
}
CardBuilder constructs a card component with optional header, body, footer, image, and variant styling.
func NewCard ¶ added in v1.1.0
func NewCard() *CardBuilder
NewCard creates a new CardBuilder with default settings.
func (*CardBuilder) Build ¶ added in v1.1.0
func (c *CardBuilder) Build() *Node
Build compiles the card into a *Node.
func (*CardBuilder) CardBody ¶ added in v1.1.0
func (c *CardBuilder) CardBody(n *Node) *CardBuilder
CardBody sets the card body node.
func (*CardBuilder) CardClass ¶ added in v1.1.0
func (c *CardBuilder) CardClass(cls string) *CardBuilder
CardClass appends additional CSS classes to the card container.
func (*CardBuilder) CardCompact ¶ added in v1.1.0
func (c *CardBuilder) CardCompact(cp bool) *CardBuilder
CardCompact reduces padding and image height.
func (*CardBuilder) CardFooter ¶ added in v1.1.0
func (c *CardBuilder) CardFooter(n *Node) *CardBuilder
CardFooter sets the card footer node.
func (*CardBuilder) CardHeader ¶ added in v1.1.0
func (c *CardBuilder) CardHeader(n *Node) *CardBuilder
CardHeader sets the card header node.
func (*CardBuilder) CardHover ¶ added in v1.1.0
func (c *CardBuilder) CardHover(h bool) *CardBuilder
CardHover enables a lift effect on hover.
func (*CardBuilder) CardImage ¶ added in v1.1.0
func (c *CardBuilder) CardImage(src, alt string) *CardBuilder
CardImage sets the card image source URL and alt text.
func (*CardBuilder) CardImagePriority ¶ added in v1.1.0
func (c *CardBuilder) CardImagePriority(p bool) *CardBuilder
CardImagePriority marks the card image with fetchpriority="high" for LCP optimization. Use on the most important above-the-fold card image.
func (*CardBuilder) CardImageSize ¶ added in v1.1.0
func (c *CardBuilder) CardImageSize(width, height string) *CardBuilder
CardImageSize sets explicit width and height on the card image to prevent layout shifts (CLS). Values should be the intrinsic pixel dimensions.
func (*CardBuilder) CardPadding ¶ added in v1.1.0
func (c *CardBuilder) CardPadding(p string) *CardBuilder
CardPadding overrides the default padding class.
func (*CardBuilder) CardVariant ¶ added in v1.1.0
func (c *CardBuilder) CardVariant(v string) *CardBuilder
CardVariant sets the card variant: "shadowed", "bordered", "flat", or "glass".
type ColOpt ¶ added in v1.1.0
type ColOpt[T any] struct { Text func(*T) *Node // cell renderer Sortable bool // whether the column is sortable Filter FilterType // filter type (NumFilter, TxtFilter, DateFilter, SelectFilter); empty = no filter FilterOptions []string // options for SelectFilter HeadCls string // CSS class for the <th> CellCls string // CSS class for the <td> }
ColOpt configures a column added via Col.
type Collate ¶
type Collate[T any] struct { // contains filtered or unexported fields }
Collate is a generic data component with a filter/sort panel, search bar, load-more pagination, and Excel export. Data fetching is delegated to a user-defined WS action.
func NewCollate ¶ added in v1.1.0
NewCollate creates a new Collate with sensible defaults.
func (*Collate[T]) Action ¶ added in v1.1.0
Action sets the WS action name for all operations. The action receives: {operation, search, page, limit, order, filters}
func (*Collate[T]) BodyID ¶ added in v1.1.0
BodyID returns the ID of the body container for use with ToJSAppend.
func (*Collate[T]) CollateClass ¶ added in v1.1.0
CollateClass sets the wrapper CSS classes.
func (*Collate[T]) Detail ¶ added in v1.1.0
Detail sets a function that renders expandable detail content for each row. When set, clicking a row toggles an accordion-style detail panel below it with a smooth expand/collapse animation.
func (*Collate[T]) EmptyIcon ¶ added in v1.1.0
EmptyIcon sets the Material Icon name for the empty state.
func (*Collate[T]) Filter ¶ added in v1.1.0
func (c *Collate[T]) Filter(fields ...CollateFilterField) *Collate[T]
Filter adds filterable fields shown in the filter panel.
func (*Collate[T]) FooterID ¶ added in v1.1.0
FooterID returns the ID of the footer element for use with ToJSReplace.
func (*Collate[T]) Locale ¶ added in v1.1.6
func (c *Collate[T]) Locale(l *CollateLocale) *Collate[T]
Locale sets a per-instance locale for this component's UI strings. When nil (default), English text is used.
collate.Locale(&ui.CollateLocale{Search: "Hľadať...", Apply: "Použiť"})
func (*Collate[T]) Render ¶ added in v1.1.0
Render builds the full Collate Node tree from the provided data slice.
func (*Collate[T]) RenderFooter ¶ added in v1.1.0
RenderFooter builds just the footer node (for replacing after load-more).
func (*Collate[T]) RenderRows ¶ added in v1.1.0
RenderRows builds only the data row nodes (for appending on "load more").
func (*Collate[T]) Row ¶ added in v1.1.0
Row sets the function that renders each data item. The function receives a pointer to the item and its index.
func (*Collate[T]) RowOffset ¶ added in v1.1.0
RowOffset sets the starting offset for alternating row stripes.
func (*Collate[T]) SetFilter ¶ added in v1.1.0
func (c *Collate[T]) SetFilter(field string, val *CollateFilterValue) *Collate[T]
SetFilter sets a filter value for a field.
func (*Collate[T]) Sort ¶ added in v1.1.0
func (c *Collate[T]) Sort(fields ...CollateSortField) *Collate[T]
Sort adds sortable fields shown as buttons in the filter panel.
func (*Collate[T]) TotalItems ¶ added in v1.1.0
TotalItems sets the total matching item count for display.
type CollateFilterField ¶ added in v1.1.0
type CollateFilterField struct {
Field string // DB field name
Label string // display label
Type CollateFilterType // control type
Options []CollateOption // for CollateSelect / CollateMultiCheck
}
CollateFilterField describes a filterable field shown in the filter panel.
type CollateFilterType ¶ added in v1.1.0
type CollateFilterType int
CollateFilterType defines the kind of filter control.
const ( CollateBool CollateFilterType = iota // checkbox CollateDateRange // from/to date pickers CollateSelect // dropdown select CollateMultiCheck // multiple checkboxes (like old BOOL with condition) )
type CollateFilterValue ¶ added in v1.1.0
type CollateFilterValue struct {
Field string `json:"field"`
Type string `json:"type"` // "bool", "date", "select"
Bool bool `json:"bool"` // for CollateBool
From string `json:"from"` // for CollateDateRange
To string `json:"to"` // for CollateDateRange
Value string `json:"value"` // for CollateSelect
}
CollateFilterValue holds the current value of a filter.
type CollateLocale ¶ added in v1.1.6
type CollateLocale struct {
FilterLocale // date/range labels shared with DataTable
Search string // search input placeholder
Apply string // apply button
Reset string // reset button
Excel string // export button
PDF string // PDF export button
Filter string // filter toggle button
LoadMore string // load more button
NoData string // empty state
AllOption string // "— All —" select option
FiltersAndSorting string // panel header
Filters string // filters section header
SortBy string // sort section header
// ItemCount formats "X of Y" — receives (showing, total).
ItemCount func(showing, total int) string
}
CollateLocale holds all translatable strings used by Collate. Create one only when you need non-English text; pass it via .Locale().
loc := &ui.CollateLocale{Search: "Hľadať...", Apply: "Použiť", ...}
collate := ui.NewCollate[T]("c").Locale(loc)
type CollateOption ¶ added in v1.1.0
CollateOption is a key/value pair for select and multi-check filters.
type CollateSortField ¶ added in v1.1.0
CollateSortField describes a sortable field shown as a button in the filter panel.
type ColumnFilter ¶ added in v1.1.0
type ColumnFilter struct {
Type FilterType
Options []string // for select type
Label string // column label for the filter popup
}
ColumnFilter defines filter configuration for a column
type ConfirmLocale ¶ added in v1.1.6
ConfirmLocale holds translatable strings for ConfirmDialog.
type ConfirmOpt ¶ added in v1.1.6
type ConfirmOpt struct {
CancelAction *Action // custom cancel action; nil = dismiss overlay
Locale *ConfirmLocale // per-instance locale; nil = English default
}
ConfirmDialog creates a fixed-overlay confirmation dialog with title, message, a confirm button (red), and a cancel button. ConfirmOpt configures optional ConfirmDialog settings.
type Context ¶
type Context struct {
Request *http.Request
Session map[string]any
PathParams map[string]string
Query map[string]string
// contains filtered or unexported fields
}
Context carries request data for both page renders and WS action calls.
func (*Context) Broadcast ¶ added in v1.1.0
Broadcast sends a JS string to ALL connected WebSocket clients.
func (*Context) HeadCSS ¶ added in v1.1.4
HeadCSS registers external stylesheets and/or inline CSS rules for the current page. On a full page load the tags are injected into the HTML <head> server-side (instant, no JS needed). On SPA navigations (WS actions) the same resources are injected into <head> via JS with deduplication so they are not loaded twice.
ctx.HeadCSS(
[]string{"https://fonts.googleapis.com/css2?family=Oswald&display=swap"},
`.hero { font-family: 'Oswald', sans-serif; }`,
)
Pass nil for urls if you only need inline CSS, or "" for css if you only need external links.
func (*Context) HeadJS ¶ added in v1.1.3
HeadJS registers a JavaScript block that runs once when the page loads. On a full page load the script is emitted as a <script> tag in <head>. On SPA navigations the code is prepended to the WS response so it executes before the DOM swap.
Use this for page-level setup (global functions, event listeners, etc.) instead of the Div("").JS(`...`) pattern.
ctx.HeadJS(`
window.toggleMobileNav = function() {
var nav = document.getElementById('mobile-nav');
if (nav) nav.classList.toggle('hidden');
};
`)
func (*Context) Push ¶ added in v1.1.0
Push sends a JS string to THIS client connection immediately. Useful for sending additional updates outside the normal request/response. Returns an error if the connection's push context has been cancelled (e.g. the client navigated away or reported a missing target element).
type DataTable ¶ added in v1.1.0
type DataTable[T any] struct { // contains filtered or unexported fields }
DataTable is a generic, configurable table component with built-in search, pagination, sorting indicators, export support, and per-column filtering. Data fetching is delegated to user-defined WS actions.
func NewDataTable ¶ added in v1.1.0
NewDataTable creates a new DataTable with the given wrapper ID. The ID is used on the outer div, enabling Replace() for live updates.
func (*DataTable[T]) Action ¶ added in v1.1.0
Action sets the single WS action name for all table operations (search, sort, page, export). The action will receive: {operation, search, page, sort, dir} where operation is one of: "search", "sort", "page", "export"
func (*DataTable[T]) Col ¶ added in v1.1.0
Col adds a column with header label and options including the render function. The label is also used as the filter label when a Filter type is set.
func (*DataTable[T]) DataTableClass ¶ added in v1.1.0
DataTableClass sets the wrapper div's CSS classes.
func (*DataTable[T]) Detail ¶ added in v1.1.0
Detail sets a function that renders expandable detail content for each row. When set, a chevron toggle column is automatically added as the last column and clicking the row toggles an accordion-style detail panel below it.
func (*DataTable[T]) Field ¶ added in v1.1.0
Field adds a column whose cell content is a *Node returned by fn.
func (*DataTable[T]) FieldText ¶ added in v1.1.0
FieldText adds a column whose cell content is plain text returned by fn. The text is set via .Text() on the <td>, which uses textContent (auto-escaped).
func (*DataTable[T]) FilterDate ¶ added in v1.1.0
FilterDate adds a date filter to a column with the given index. Deprecated: Use Col() with ColOpt{Filter: DateFilter(label)} instead.
func (*DataTable[T]) FilterNumber ¶ added in v1.1.0
FilterNumber adds a number filter to a column with the given index. Deprecated: Use Col() with ColOpt{Filter: NumFilter(label)} instead.
func (*DataTable[T]) FilterSelect ¶ added in v1.1.0
FilterSelect adds a select/multi-select filter to a column with the given index. Deprecated: Use Col() with ColOpt{Filter: SelectFilter(label, options)} instead.
func (*DataTable[T]) FilterText ¶ added in v1.1.0
FilterText adds a text filter to a column with the given index. Deprecated: Use Col() with ColOpt{Filter: TxtFilter(label)} instead.
func (*DataTable[T]) FooterID ¶ added in v1.1.0
FooterID returns the ID of the footer element for use with ToJSReplace.
func (*DataTable[T]) HasMore ¶ added in v1.1.0
HasMore indicates there are more rows to load (shows "load more" button).
func (*DataTable[T]) HeadHTML ¶ added in v1.1.0
HeadHTML adds a header column whose label is rendered as raw content.
func (*DataTable[T]) Locale ¶ added in v1.1.6
func (dt *DataTable[T]) Locale(l *TableLocale) *DataTable[T]
Locale sets a per-instance locale for this table's UI strings. When nil (default), English text is used.
table.Locale(&ui.TableLocale{Search: "Hľadať...", Apply: "Použiť"})
func (*DataTable[T]) PageSize ¶ added in v1.1.0
PageSize sets the number of items per page (default 10).
func (*DataTable[T]) Render ¶ added in v1.1.0
Render builds the full table Node tree from the provided data slice.
func (*DataTable[T]) RenderFooter ¶ added in v1.1.0
RenderFooter builds just the footer node (for replacing after load-more).
func (*DataTable[T]) RenderRows ¶ added in v1.1.0
RenderRows builds only the <tr> rows (no wrapper, no thead, no toolbar). Use with ToJSAppend to the tbody ID (dt.id + "-tbody") for "load more".
func (*DataTable[T]) RowOffset ¶ added in v1.1.0
RowOffset sets the starting offset for alternating row stripe colors. Used when appending rows to maintain correct striping.
func (*DataTable[T]) Search ¶ added in v1.1.0
Search sets the current search query value (for re-rendering).
func (*DataTable[T]) SetFilterLabels ¶ added in v1.1.0
func (dt *DataTable[T]) SetFilterLabels(badges []FilterBadge) *DataTable[T]
SetFilterLabels sets the active filter badges to display above the table.
func (*DataTable[T]) SetFilterValue ¶ added in v1.1.0
func (dt *DataTable[T]) SetFilterValue(colIdx int, value *FilterValue) *DataTable[T]
SetFilterValue sets a filter value for a column.
func (*DataTable[T]) Sortable ¶ added in v1.1.0
Sortable marks which column indices support click-to-sort.
func (*DataTable[T]) TableClass ¶ added in v1.1.0
TableClass overrides the <table> element's CSS classes.
func (*DataTable[T]) TbodyID ¶ added in v1.1.0
TbodyID returns the ID of the tbody element for use with ToJSAppend.
func (*DataTable[T]) TotalItems ¶ added in v1.1.0
TotalItems sets the total item count for display (e.g. "42 items").
func (*DataTable[T]) TotalPages ¶ added in v1.1.0
TotalPages sets the total number of pages.
type DropdownBuilder ¶ added in v1.1.0
type DropdownBuilder struct {
// contains filtered or unexported fields
}
DropdownBuilder constructs a dropdown menu attached to a trigger node.
func NewDropdown ¶ added in v1.1.0
func NewDropdown(trigger *Node) *DropdownBuilder
NewDropdown creates a new DropdownBuilder with the given trigger node.
func (*DropdownBuilder) Build ¶ added in v1.1.0
func (d *DropdownBuilder) Build() *Node
Build compiles the dropdown into a *Node.
func (*DropdownBuilder) DropdownClass ¶ added in v1.1.0
func (d *DropdownBuilder) DropdownClass(cls string) *DropdownBuilder
DropdownClass appends additional CSS classes to the wrapper.
func (*DropdownBuilder) DropdownDanger ¶ added in v1.1.0
func (d *DropdownBuilder) DropdownDanger(label string, action *Action, icon ...string) *DropdownBuilder
DropdownDanger adds a danger-styled menu item.
func (*DropdownBuilder) DropdownDivider ¶ added in v1.1.0
func (d *DropdownBuilder) DropdownDivider() *DropdownBuilder
DropdownDivider adds a visual separator.
func (*DropdownBuilder) DropdownHeader ¶ added in v1.1.0
func (d *DropdownBuilder) DropdownHeader(label string) *DropdownBuilder
DropdownHeader adds a non-interactive header label.
func (*DropdownBuilder) DropdownItem ¶ added in v1.1.0
func (d *DropdownBuilder) DropdownItem(label string, action *Action, icon ...string) *DropdownBuilder
DropdownItem adds a menu item with label, action, and optional icon.
func (*DropdownBuilder) DropdownPosition ¶ added in v1.1.0
func (d *DropdownBuilder) DropdownPosition(p string) *DropdownBuilder
DropdownPosition sets the dropdown position relative to the trigger.
type Field ¶ added in v1.1.0
type Field struct {
Type FieldType
Name string // maps to Attr("name",...) and struct json tag
Label string
Placeholder string
Value string
Checked bool // only for FieldCheckbox
Required bool
Pattern string // regex pattern for client+server validation
ErrMsg string // custom error message (defaults to "<Label> is required")
Options []FieldOption
Class string // override input class
WrapClass string // override wrapper class
}
Field holds the declarative definition for one form field.
type FieldBuilder ¶ added in v1.1.0
type FieldBuilder struct {
// contains filtered or unexported fields
}
FieldBuilder provides chained configuration for a single field.
func (*FieldBuilder) Class ¶ added in v1.1.0
func (fb *FieldBuilder) Class(cls string) *FieldBuilder
Class overrides the input element's CSS class.
func (*FieldBuilder) Err ¶ added in v1.1.0
func (fb *FieldBuilder) Err(msg string) *FieldBuilder
Err sets a custom error message for the field.
func (*FieldBuilder) IsChecked ¶ added in v1.1.0
func (fb *FieldBuilder) IsChecked(c bool) *FieldBuilder
IsChecked sets the checkbox checked state.
func (*FieldBuilder) Opts ¶ added in v1.1.0
func (fb *FieldBuilder) Opts(pairs ...string) *FieldBuilder
Opts adds value:label option pairs. Format: "value:Label" or just "Label" (in which case value = lowercase label). An empty value like ":Select..." creates a placeholder option.
func (*FieldBuilder) PatternValidation ¶ added in v1.1.0
func (fb *FieldBuilder) PatternValidation(p string) *FieldBuilder
PatternValidation sets a regex pattern for client+server validation.
func (*FieldBuilder) Placeholder ¶ added in v1.1.0
func (fb *FieldBuilder) Placeholder(p string) *FieldBuilder
Placeholder sets the input placeholder text.
func (*FieldBuilder) Render ¶ added in v1.1.0
func (fb *FieldBuilder) Render() *FormBuilder
Render returns the FormBuilder to continue chaining at the form level.
func (*FieldBuilder) Required ¶ added in v1.1.0
func (fb *FieldBuilder) Required() *FieldBuilder
Required marks the field as required for validation.
func (*FieldBuilder) Value ¶ added in v1.1.0
func (fb *FieldBuilder) Value(v string) *FieldBuilder
Value sets the current field value (for re-rendering after submit).
func (*FieldBuilder) WrapClass ¶ added in v1.1.0
func (fb *FieldBuilder) WrapClass(cls string) *FieldBuilder
WrapClass overrides the wrapper div's CSS class.
type FieldOption ¶ added in v1.1.0
FieldOption represents a value/label pair for select and radio fields.
type FieldType ¶ added in v1.1.0
type FieldType int
FieldType enumerates supported field kinds.
const ( FieldText FieldType = iota // <input type="text"> FieldPassword // <input type="password"> FieldEmail // <input type="email"> FieldNumber // <input type="number"> FieldPhone // <input type="tel"> FieldDate // <input type="date"> FieldTime // <input type="time"> FieldDatetime // <input type="datetime-local"> FieldUrl // <input type="url"> FieldSearch // <input type="search"> FieldTextarea // <textarea> FieldSelect // <select> FieldRadio // inline radios FieldRadioBtn // button-style radios (visible border cards) FieldRadioCard // hidden-peer card radios (peer-checked styling) FieldCheckbox // <input type="checkbox"> FieldHidden // <input type="hidden"> )
type FilterBadge ¶ added in v1.1.0
type FilterBadge struct {
Label string
Value string
Column int
OnRemove string // JS to remove this filter
}
FilterBadge represents an active filter badge
type FilterLocale ¶ added in v1.1.6
type FilterLocale struct {
From string // "From" label
To string // "To" label
Today string // date quick-select
ThisWeek string
ThisMonth string
ThisQuarter string
ThisYear string
LastMonth string
LastYear string
}
FilterLocale holds translatable strings shared by filter UIs (date pickers, number/text operators). Embedded by both TableLocale and CollateLocale.
type FilterOperator ¶ added in v1.1.0
type FilterOperator string
FilterOperator defines the operator for text/number filters
const ( OpContains FilterOperator = "contains" OpStartsWith FilterOperator = "startswith" OpEquals FilterOperator = "equals" OpRange FilterOperator = "range" OpGTE FilterOperator = "gte" OpLTE FilterOperator = "lte" OpGT FilterOperator = "gt" OpLT FilterOperator = "lt" )
type FilterType ¶ added in v1.1.0
type FilterType string
FilterType defines the type of filter for a column
const ( FilterTypeText FilterType = "text" FilterTypeDate FilterType = "date" FilterTypeNumber FilterType = "number" FilterTypeSelect FilterType = "select" )
const ( NumFilter FilterType = FilterTypeNumber TxtFilter FilterType = FilterTypeText DateFilter FilterType = FilterTypeDate SelectFilter FilterType = FilterTypeSelect )
type FilterValue ¶ added in v1.1.0
type FilterValue struct {
Operator string `json:"op"`
Value string `json:"val"`
Values []string `json:"vals"` // for multi-select
From string `json:"from"` // for date/number range
To string `json:"to"` // for date/number range
}
FilterValue represents a filter value for a column
type FormBuilder ¶ added in v1.1.0
type FormBuilder struct {
// contains filtered or unexported fields
}
FormBuilder accumulates fields and submit buttons, then renders to Nodes.
func NewForm ¶ added in v1.1.0
func NewForm(id string) *FormBuilder
NewForm creates a new form builder with the given container ID.
func (*FormBuilder) Action ¶ added in v1.1.0
func (f *FormBuilder) Action(name string) *FormBuilder
Action sets the WS action name that the form submits to.
func (*FormBuilder) Area ¶ added in v1.1.0
func (f *FormBuilder) Area(label, name string) *FieldBuilder
func (*FormBuilder) Build ¶ added in v1.1.0
func (f *FormBuilder) Build() *Node
Build renders the form into a Node tree. It emits a <form> element (with onsubmit prevented) and sets the HTML "form" attribute on every input, select, and textarea so they are formally associated. This lets multiple independent forms coexist on the same page without nesting <form> elements — inputs can live anywhere in the DOM.
func (*FormBuilder) Checkbox ¶ added in v1.1.0
func (f *FormBuilder) Checkbox(label, name string) *FieldBuilder
func (*FormBuilder) DateField ¶ added in v1.1.0
func (f *FormBuilder) DateField(label, name string) *FieldBuilder
func (*FormBuilder) DatetimeField ¶ added in v1.1.0
func (f *FormBuilder) DatetimeField(label, name string) *FieldBuilder
func (*FormBuilder) Email ¶ added in v1.1.0
func (f *FormBuilder) Email(label, name string) *FieldBuilder
func (*FormBuilder) ErrClass ¶ added in v1.1.0
func (f *FormBuilder) ErrClass(cls string) *FormBuilder
ErrClass sets the CSS class for error messages.
func (*FormBuilder) FormClass ¶ added in v1.1.0
func (f *FormBuilder) FormClass(cls string) *FormBuilder
FormClass overrides the form wrapper div class.
func (*FormBuilder) Hidden ¶ added in v1.1.0
func (f *FormBuilder) Hidden(name string) *FieldBuilder
func (*FormBuilder) InputClass ¶ added in v1.1.0
func (f *FormBuilder) InputClass(cls string) *FormBuilder
InputClass sets the default CSS class for all text-like inputs.
func (*FormBuilder) Number ¶ added in v1.1.0
func (f *FormBuilder) Number(label, name string) *FieldBuilder
func (*FormBuilder) Password ¶ added in v1.1.0
func (f *FormBuilder) Password(label, name string) *FieldBuilder
func (*FormBuilder) Phone ¶ added in v1.1.0
func (f *FormBuilder) Phone(label, name string) *FieldBuilder
func (*FormBuilder) Radio ¶ added in v1.1.0
func (f *FormBuilder) Radio(label, name string) *FieldBuilder
func (*FormBuilder) RadioBtn ¶ added in v1.1.0
func (f *FormBuilder) RadioBtn(label, name string) *FieldBuilder
func (*FormBuilder) RadioCard ¶ added in v1.1.0
func (f *FormBuilder) RadioCard(label, name string) *FieldBuilder
func (*FormBuilder) SearchField ¶ added in v1.1.0
func (f *FormBuilder) SearchField(label, name string) *FieldBuilder
func (*FormBuilder) SelectField ¶ added in v1.1.0
func (f *FormBuilder) SelectField(label, name string) *FieldBuilder
func (*FormBuilder) Submit ¶ added in v1.1.0
func (f *FormBuilder) Submit(action, label, class string) *FormBuilder
Submit adds a submit button with an action value, label, and CSS class.
func (*FormBuilder) Text ¶ added in v1.1.0
func (f *FormBuilder) Text(label, name string) *FieldBuilder
func (*FormBuilder) TimeField ¶ added in v1.1.0
func (f *FormBuilder) TimeField(label, name string) *FieldBuilder
func (*FormBuilder) UrlField ¶ added in v1.1.0
func (f *FormBuilder) UrlField(label, name string) *FieldBuilder
func (*FormBuilder) Validate ¶ added in v1.1.0
func (f *FormBuilder) Validate(data map[string]any) FormErrors
Validate checks the data map against the form's field definitions. It returns a FormErrors map (empty if all valid). The data parameter should be the map[string]any from ctx.Body().
type FormErrors ¶ added in v1.1.0
FormErrors holds field-level validation errors.
func (FormErrors) Get ¶ added in v1.1.0
func (fe FormErrors) Get(name string) string
Get returns the error for a specific field name, or empty string.
func (FormErrors) HasErrors ¶ added in v1.1.0
func (fe FormErrors) HasErrors() bool
HasErrors returns true if any field has an error.
type LayoutHandler ¶ added in v1.1.1
LayoutHandler builds a shared layout wrapping every page. The returned *Node tree must contain exactly one element with ID("__content__") where the page content will be injected.
type Node ¶ added in v1.1.0
type Node struct {
// contains filtered or unexported fields
}
Node represents a DOM element built in Go that compiles to JavaScript.
func ConfirmDialog ¶ added in v0.111.21
func ConfirmDialog(title, message string, confirmAction *Action, opts ...ConfirmOpt) *Node
func Div ¶
Convenience constructors. All accept an optional single class string.
Div("flex gap-4 items-center")
Button("px-4 py-2 bg-blue-600 text-white")
Span() // no classes
func El ¶
El creates a node with an arbitrary tag and optional CSS class string.
El("section", "max-w-5xl mx-auto")
func Figcaption ¶ added in v1.1.0
func FilterPopup ¶ added in v1.1.0
func FilterPopup(colIdx int, colLabel string, filterType FilterType, options []string, currentValue *FilterValue, l ...*TableLocale) *Node
FilterPopup renders a filter popup for a specific column. This should be used by the server to render the popup content when operation='openFilter' is received.
func Icon ¶
Icon renders a Material Symbols icon using Material Icons Round font. The name parameter is the icon ligature (e.g. "home", "settings"). Optional class strings are appended to the base icon class.
func IconText ¶ added in v1.1.0
IconText renders a flex row containing a Material icon and text label. Optional class strings are applied to the outer wrapper.
func Map ¶
Map iterates a slice, calls fn for each item, and returns a parent with the results as children. Useful for rendering lists.
func Markdown ¶
Markdown converts a markdown string to HTML and renders it inside a Div. Since the framework produces only document.createElement JS (no innerHTML setter on nodes), this uses .JS() to set innerHTML after the node mounts. The class parameter is applied to the container div.
func SkeletonCards ¶ added in v0.111.20
func SkeletonCards() *Node
SkeletonCards returns an animated pulse skeleton of a 6-card responsive grid.
func SkeletonComponent ¶
func SkeletonComponent() *Node
SkeletonComponent returns an animated pulse skeleton of a single card with a title, 3 text lines, and a button placeholder.
func SkeletonForm ¶
func SkeletonForm() *Node
SkeletonForm returns an animated pulse skeleton of a form with 4 label+input pairs and a submit button placeholder.
func SkeletonList ¶
func SkeletonList() *Node
SkeletonList returns an animated pulse skeleton of 5 list rows, each with a circle avatar placeholder and two text line placeholders.
func SkeletonPage ¶
func SkeletonPage() *Node
SkeletonPage returns an animated pulse skeleton of a full page layout with a header bar, sidebar column, and main content area.
func SkeletonTable ¶ added in v0.111.20
func SkeletonTable() *Node
SkeletonTable returns an animated pulse skeleton representing a 4-column table with a header row and 5 data rows.
func ThemeSwitcher ¶
func ThemeSwitcher(opts ...ThemeSwitcherOpt) *Node
ThemeSwitcher renders a tri-state toggle button that cycles through System → Light → Dark themes. It reads from localStorage("theme"), calls window.setTheme(mode), and updates its icon+label reactively.
func (*Node) Class ¶ added in v1.1.0
Class appends additional CSS classes (space-separated) to any classes already set via the constructor. Useful for conditional class additions.
func (*Node) JS ¶ added in v1.1.0
JS sets raw JavaScript to execute after this node is appended to the DOM.
func (*Node) OnClick ¶ added in v1.1.0
OnClick attaches a click event that calls a server action via WS.
func (*Node) Render ¶ added in v1.1.0
Render appends child nodes and returns this node. This is the primary way to compose a node tree. Nil children are silently skipped.
Div("flex", "gap-4").Render(
H1("text-3xl").Text("Title"),
P("text-gray-600").Text("Description"),
)
func (*Node) ToJS ¶ added in v1.1.0
ToJS compiles the node tree into a self-executing JavaScript function that builds and appends the entire tree to document.body.
func (*Node) ToJSAppend ¶ added in v1.1.0
ToJSAppend compiles JS that appends this node as a child of the target element.
func (*Node) ToJSInner ¶ added in v1.1.0
ToJSInner compiles JS that replaces the innerHTML of a target element with this node (sets target's children to just this node).
func (*Node) ToJSPrepend ¶ added in v1.1.0
ToJSPrepend compiles JS that prepends this node as the first child.
func (*Node) ToJSReplace ¶ added in v1.1.0
ToJSReplace compiles JS that replaces an existing DOM element by its ID. The old element is found by ID, the new tree is built, and replaceWith() is called.
type PageHandler ¶ added in v1.1.0
PageHandler builds the initial DOM for a GET route.
type ProgressBuilder ¶ added in v1.1.0
type ProgressBuilder struct {
// contains filtered or unexported fields
}
ProgressBuilder constructs a progress bar component.
func NewProgress ¶ added in v1.1.0
func NewProgress() *ProgressBuilder
NewProgress creates a new ProgressBuilder with default settings.
func (*ProgressBuilder) Animated ¶ added in v1.1.0
func (p *ProgressBuilder) Animated(a bool) *ProgressBuilder
Animated enables animated stripe movement (implies striped).
func (*ProgressBuilder) Build ¶ added in v1.1.0
func (p *ProgressBuilder) Build() *Node
Build compiles the progress bar into a *Node.
func (*ProgressBuilder) Indeterminate ¶ added in v1.1.0
func (p *ProgressBuilder) Indeterminate(i bool) *ProgressBuilder
Indeterminate shows a bouncing bar with no specific value.
func (*ProgressBuilder) LabelPosition ¶ added in v1.1.0
func (p *ProgressBuilder) LabelPosition(pos string) *ProgressBuilder
LabelPosition sets the label position: "inside" or "outside".
func (*ProgressBuilder) ProgressClass ¶ added in v1.1.0
func (p *ProgressBuilder) ProgressClass(cls string) *ProgressBuilder
ProgressClass appends additional CSS classes to the outer wrapper.
func (*ProgressBuilder) ProgressColor ¶ added in v1.1.0
func (p *ProgressBuilder) ProgressColor(c string) *ProgressBuilder
ProgressColor sets the bar background color class.
func (*ProgressBuilder) ProgressGradient ¶ added in v1.1.0
func (p *ProgressBuilder) ProgressGradient(colors ...string) *ProgressBuilder
ProgressGradient sets gradient colors (overrides solid color).
func (*ProgressBuilder) ProgressLabel ¶ added in v1.1.0
func (p *ProgressBuilder) ProgressLabel(l string) *ProgressBuilder
ProgressLabel sets a text label to display on or above the bar.
func (*ProgressBuilder) ProgressSize ¶ added in v1.1.0
func (p *ProgressBuilder) ProgressSize(s string) *ProgressBuilder
ProgressSize sets the bar height: "xs", "sm", "md", "lg", "xl".
func (*ProgressBuilder) ProgressValue ¶ added in v1.1.0
func (p *ProgressBuilder) ProgressValue(v int) *ProgressBuilder
ProgressValue sets the progress percentage, clamped to 0-100.
func (*ProgressBuilder) Striped ¶ added in v1.1.0
func (p *ProgressBuilder) Striped(s bool) *ProgressBuilder
Striped enables diagonal stripe pattern on the bar.
type RadioStyle ¶ added in v1.1.0
type RadioStyle = FieldType
RadioStyle is an alias kept for readability in the API.
type Response ¶ added in v1.1.0
type Response struct {
// contains filtered or unexported fields
}
Response collects multiple JS statements into a single response string.
func NewResponse ¶ added in v1.1.0
func NewResponse() *Response
NewResponse creates an empty response builder.
func (*Response) Inner ¶ added in v1.1.0
Render adds a node innerHTML replacement operation to the response.
func (*Response) Navigate ¶ added in v1.1.0
Navigate updates the browser URL via pushState without a page reload.
type SimpleTable ¶
type SimpleTable struct {
// contains filtered or unexported fields
}
SimpleTable builds a basic table from manually added cells. Rows are auto-wrapped based on numCols.
func NewSimpleTable ¶ added in v1.1.0
func NewSimpleTable(numCols int, cls ...string) *SimpleTable
NewSimpleTable creates a new SimpleTable with the given number of columns.
func (*SimpleTable) Build ¶ added in v1.1.0
func (t *SimpleTable) Build() *Node
Build renders the SimpleTable into a *Node.
func (*SimpleTable) Cell ¶ added in v1.1.0
func (t *SimpleTable) Cell(node *Node) *SimpleTable
Cell adds a *Node cell to the table. When the current row reaches numCols, it is flushed and a new row starts automatically.
func (*SimpleTable) CellText ¶ added in v1.1.0
func (t *SimpleTable) CellText(text string) *SimpleTable
CellText adds a plain text cell.
func (*SimpleTable) SimpleHeader ¶ added in v1.1.0
func (t *SimpleTable) SimpleHeader(labels ...string) *SimpleTable
SimpleHeader sets the header labels for the table.
type StepProgressBuilder ¶ added in v1.1.0
type StepProgressBuilder struct {
// contains filtered or unexported fields
}
StepProgressBuilder constructs a simple step progress indicator.
func NewStepProgress ¶ added in v1.1.0
func NewStepProgress(current, total int) *StepProgressBuilder
NewStepProgress creates a new StepProgressBuilder.
func (*StepProgressBuilder) Build ¶ added in v1.1.0
func (s *StepProgressBuilder) Build() *Node
Build compiles the step progress into a *Node.
func (*StepProgressBuilder) Locale ¶ added in v1.1.6
func (s *StepProgressBuilder) Locale(l *StepProgressLocale) *StepProgressBuilder
Locale sets a per-instance locale.
func (*StepProgressBuilder) StepClass ¶ added in v1.1.0
func (s *StepProgressBuilder) StepClass(cls string) *StepProgressBuilder
StepClass appends additional CSS classes.
func (*StepProgressBuilder) StepColor ¶ added in v1.1.0
func (s *StepProgressBuilder) StepColor(c string) *StepProgressBuilder
StepColor sets the fill bar color class.
func (*StepProgressBuilder) StepSize ¶ added in v1.1.0
func (s *StepProgressBuilder) StepSize(sz string) *StepProgressBuilder
StepSize sets the bar height: "xs", "sm", "md", "lg", "xl".
type StepProgressLocale ¶ added in v1.1.6
type StepProgressLocale struct {
// StepOf formats "Step X of Y" — receives (current, total).
StepOf func(current, total int) string
}
StepProgressLocale holds translatable strings for StepProgress.
type TableLocale ¶ added in v1.1.6
type TableLocale struct {
FilterLocale // date/range labels shared with Collate
Search string // search input placeholder
Apply string // apply button
Cancel string // cancel button
Reset string // reset button
Excel string // export button
PDF string // PDF export button
LoadMore string // load more button
NoData string // empty state
SearchText string // text filter input placeholder
SelectAll string // select all label
ClearSelect string // clear selection label
Value string // "Value" placeholder (number filter)
Contains string // text filter operator
StartsWith string // text filter operator
Equals string // text filter operator
Range string // number filter operator
GreaterOrEq string // ≥
LessOrEq string // ≤
GreaterThan string // >
LessThan string // <
NumEquals string // = (number)
// ItemCount formats "X of Y" — receives (showing, total).
ItemCount func(showing, total int) string
}
TableLocale holds all translatable strings used by DataTable. Create one only when you need non-English text; pass it via .Locale().
loc := &ui.TableLocale{Search: "Hľadať...", Apply: "Použiť", ...}
table := ui.NewDataTable[T]("t").Locale(loc)
type TabsBuilder ¶ added in v1.1.0
type TabsBuilder struct {
// contains filtered or unexported fields
}
TabsBuilder constructs a tabbed interface with multiple panels.
func (*TabsBuilder) Active ¶ added in v1.1.0
func (t *TabsBuilder) Active(index int) *TabsBuilder
Active sets the initially active tab index (0-based).
func (*TabsBuilder) Build ¶ added in v1.1.0
func (t *TabsBuilder) Build() *Node
Build compiles the tabs into a *Node.
func (*TabsBuilder) Tab ¶ added in v1.1.0
func (t *TabsBuilder) Tab(label string, content *Node, icon ...string) *TabsBuilder
Tab adds a tab with label, content panel, and optional icon.
func (*TabsBuilder) TabStyle ¶ added in v1.1.0
func (t *TabsBuilder) TabStyle(s string) *TabsBuilder
TabStyle sets the tab style: "underline", "pills", "boxed", "vertical".
func (*TabsBuilder) TabsClass ¶ added in v1.1.0
func (t *TabsBuilder) TabsClass(cls string) *TabsBuilder
TabsClass appends additional CSS classes.
type ThemeSwitcherLocale ¶ added in v1.1.6
ThemeSwitcherLocale holds translatable strings for ThemeSwitcher.
type ThemeSwitcherOpt ¶ added in v1.1.6
type ThemeSwitcherOpt struct {
Class string // additional CSS class
Locale *ThemeSwitcherLocale // per-instance locale; nil = English default
}
ThemeSwitcherOpt configures optional ThemeSwitcher settings.
type TooltipBuilder ¶ added in v1.1.0
type TooltipBuilder struct {
// contains filtered or unexported fields
}
TooltipBuilder wraps a trigger node with a tooltip overlay shown on hover.
func NewTooltip ¶ added in v1.1.0
func NewTooltip(content string) *TooltipBuilder
NewTooltip creates a new TooltipBuilder with the given text content.
func (*TooltipBuilder) Delay ¶ added in v1.1.0
func (t *TooltipBuilder) Delay(ms int) *TooltipBuilder
Delay sets the show delay in milliseconds. 0 = pure CSS (instant).
func (*TooltipBuilder) TooltipClass ¶ added in v1.1.0
func (t *TooltipBuilder) TooltipClass(cls string) *TooltipBuilder
TooltipClass appends additional CSS classes.
func (*TooltipBuilder) TooltipPosition ¶ added in v1.1.0
func (t *TooltipBuilder) TooltipPosition(p string) *TooltipBuilder
TooltipPosition sets the tooltip position: "top", "bottom", "left", "right".
func (*TooltipBuilder) TooltipVariant ¶ added in v1.1.0
func (t *TooltipBuilder) TooltipVariant(v string) *TooltipBuilder
TooltipVariant sets the tooltip color variant.
func (*TooltipBuilder) Wrap ¶ added in v1.1.0
func (t *TooltipBuilder) Wrap(trigger *Node) *Node
Wrap wraps the given trigger node in a tooltip container and returns it.