Documentation
¶
Overview ¶
Package ui provides the GoWave virtual DOM.
ui.Node is a lightweight tree of elements that:
- Renders to HTML strings on the server (SSR)
- Compiles to WASM on the client and diffs against the live DOM
All builder functions (Div, Span, Button, etc.) return a Node. Modifiers (Class, Text, OnClick, etc.) are applied as NodeOptions.
Index ¶
- func ClearHandlers()
- func Dispatch(event, id, value string)
- func RenderHTML(n Node) string
- type Attr
- type Node
- func A(opts ...Option) Node
- func Article(opts ...Option) Node
- func Body(opts ...Option) Node
- func Button(opts ...Option) Node
- func Code(opts ...Option) Node
- func Div(opts ...Option) Node
- func Footer(opts ...Option) Node
- func Form(opts ...Option) Node
- func Fragment(children ...Node) Node
- func H1(opts ...Option) Node
- func H2(opts ...Option) Node
- func H3(opts ...Option) Node
- func Head(opts ...Option) Node
- func Header(opts ...Option) Node
- func Html(opts ...Option) Node
- func If(cond bool, then, otherwise Node) Node
- func Img(opts ...Option) Node
- func Input(opts ...Option) Node
- func Label(opts ...Option) Node
- func Li(opts ...Option) Node
- func Link(rel, href string) Node
- func Main(opts ...Option) Node
- func Map[T any](items []T, fn func(int, T) Node) []Node
- func Meta(name, content string) Node
- func Nav(opts ...Option) Node
- func Ol(opts ...Option) Node
- func P(opts ...Option) Node
- func Pre(opts ...Option) Node
- func Script(src string) Node
- func Section(opts ...Option) Node
- func Select(opts ...Option) Node
- func SelectOption(opts ...Option) Node
- func Span(opts ...Option) Node
- func Table(opts ...Option) Node
- func Tbody(opts ...Option) Node
- func Td(opts ...Option) Node
- func Textarea(opts ...Option) Node
- func Th(opts ...Option) Node
- func Thead(opts ...Option) Node
- func Title(text string) Node
- func Tr(opts ...Option) Node
- func Ul(opts ...Option) Node
- type NodeType
- type Option
- func Alt(alt string) Option
- func Attr2(key, value string) Option
- func Checked(c bool) Option
- func Child(child Node) Option
- func Children(children ...Node) Option
- func Class(c string) Option
- func DataAttr(key, value string) Option
- func Disabled(d bool) Option
- func Href(href string) Option
- func ID(id string) Option
- func KeyAttr(k string) Option
- func OnChange(fn func()) Option
- func OnClick(fn func()) Option
- func OnEnter(fn func()) Option
- func OnInput(fn func(string)) Option
- func Placeholder(p string) Option
- func Src(src string) Option
- func Text(s string) Option
- func Textf(format string, args ...any) Option
- func Value(v string) Option
- type Page
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dispatch ¶
func Dispatch(event, id, value string)
Dispatch is called by the WASM bridge to invoke a handler by ID.
func RenderHTML ¶
RenderHTML renders a Node tree to an HTML string. Called on the server for SSR; not used in the WASM binary.
Types ¶
type Attr ¶
type Attr struct {
Key string
Value string
HandlerID string // non-empty → event binding, not a plain attribute
}
Attr is a key-value HTML attribute pair. HandlerID is set for event attributes (onclick, oninput).
type Node ¶
type Node struct {
Type NodeType
Tag string
Attrs []Attr
Children []Node
Text string
Key string // for list reconciliation
}
Node is a virtual DOM node. Zero value is a valid empty fragment.
func SelectOption ¶
Click to show internal directories.
Click to hide internal directories.