dom

package module
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 1 Imported by: 0

README ΒΆ

tinywasm/dom

Project Badges

Ultra-minimal DOM & event toolkit for Go (TinyGo WASM-optimized).

tinywasm/dom provides a minimalist, WASM-optimized way to interact with the browser DOM in Go, avoiding the overhead of the standard library and syscall/js exposure. It is designed specifically for TinyGo applications where binary size and performance are critical.

πŸš€ Features

  • JSX-like Declarative View: Concise nesting with Div(H1("Title"), P("..."))
  • Typed Form Elements: Semantic API for forms with Text("email").Required()
  • Void Element Fix: Correctly renders <br>, <img>, <input> without closing tags
  • TinyGo Optimized: Avoids heavy standard library packages to keep WASM binaries <500KB
  • Direct DOM Manipulation: No Virtual DOM overhead. You control the updates.
  • ID-Based Caching: Efficient element lookup and caching strategy
  • Lifecycle Hooks: OnMount, OnUpdate, OnUnmount for fine-grained control

πŸ“¦ Installation

go get github.com/tinywasm/dom

⚑ Quick Start

For a complete example including Elm architecture (Dynamic Components) and Static Components, check the following file:

πŸ‘‰ web/client.go

This file contains the reference implementation used for testing and demonstrations.

🎨 JSX-like Builder API

The API allows concise nesting and typed chaining:

import . "github.com/tinywasm/dom"

Div(
	H1("Welcome"),
	P("Enter your credentials:"),
	Form(
		Email("user_email", "Email address").Required(false),
		Password("pwd").Placeholder("Secret password"),
		Button("Login").Attr("type", "submit"),
	).Action("/login"),
).Class("container")

Available builders:

  • Containers: Div, Span, P, H1-H6, Ul, Ol, Li, Section, Main, Article, Header, Footer, Nav, Aside, Table, Thead, Tbody, Tr, Td, etc.
  • Typed Inputs: Text, Email, Password, Number, Checkbox, Radio, File, Date, Hidden, Search, Tel, Url, Range, Color.
  • Specialized: Form, Select, Textarea, Button, A.
  • SVG: Svg, Use.
  • Void Elements: Img, Br, Hr.

πŸ”„ Lifecycle Hooks

Components can implement optional lifecycle interfaces:

type MyComponent struct {
	*dom.Element
	data []string
}

// Called after component is mounted to DOM
func (c *MyComponent) OnMount() {
	c.data = fetchData()
	c.Update()
}

// Called after re-render (dom.Update)
func (c *MyComponent) OnUpdate() {
	fmt.Println("Component updated")
}

// Called before component is removed
func (c *MyComponent) OnUnmount() {
	// Cleanup resources
}

πŸ“ Component Interface

All components must implement:

type Component interface {
	GetID() string
	SetID(string)
	RenderHTML() string  // OR Render() *Element
	Children() []Component
}

Two rendering options:

  1. RenderHTML() string - For static components (smaller binary)
  2. Render() *dom.Element - For dynamic components (type-safe, composable)

Components can implement either or both. DOM checks Render() first, falls back to RenderHTML().

🎯 Hybrid Rendering Strategy

Choose the right rendering method for each component:

Component Type Method Benefit
Static (no interactivity) RenderHTML() string Smaller binary, less overhead
Dynamic (interactive, state) Render() *dom.Element Type-safe, composable, fluent API

See the implementation examples in web/client.go to see both approaches in action.

🧩 Nested Components

Components can contain child components:

type MyList struct {
	*dom.Element
	items []dom.Component
}

func (c *MyList) Children() []dom.Component {
	return c.items
}

func (c *MyList) Render() *dom.Element {
	list := dom.Div()
	for _, item := range c.items {
		list.Add(item) // Components can be children
	}
	return list
}

When you call dom.Render("app", myList), the library will:

  1. Render the HTML
  2. Call OnMount() for MyList
  3. Recursively call OnMount() for all items

The same recursion applies to cleanup, ensuring all event listeners are cleaned up when a parent is replaced.

🎯 Event Handling

Event handling is integrated directly into the Builder API via On(eventType, handler).

πŸ”§ Core API

Package Functions
// Rendering
dom.Render(parentID, component)  // Replace parent's content
dom.Append(parentID, component)  // Append after last child
dom.Update(component)            // Re-render in place
dom.Get(id)                      // Get a DOM Reference (value, focus, events)

// Routing (hash-based)
dom.OnHashChange(handler)        // Listen to hash changes
dom.GetHash()                    // Get current hash
dom.SetHash(hash)                // Set hash
Element Helpers

Embedding *dom.Element provides these methods automatically:

type Counter struct {
	*dom.Element
	count int
}

// Chainable helpers
counter.Update()              // Trigger re-render
counter.GetID()               // Get unique ID
counter.SetID("my-id")        // Set custom ID

πŸ“š Documentation

For more detailed information, please refer to the documentation in the docs/ directory:

  1. Architecture & Builder API Guide: Comprehensive LLM-optimized guide covering the isomorphic component model, the JSX-like builder, event handling, and optimization strategies for TinyGo.

πŸ†• What's New in v0.5.0

  • βœ… Major API Redesign - JSX-like factories (Div(H1("Title")))

  • βœ… Typed Form Elements - Semantic chaining (Email("u").Required())

  • βœ… Internal Privatization - Cleaned up public API (privatized EventHandler, etc.)

  • βœ… Void Element Rendering - Correct HTML for <br>, <img>, <input>

  • βœ… Auto-ID Generation - Simplified IDs without auto- prefix

  • βœ… JSX-like factories - Concise nesting (Div(H1("Title"), P("...")))

  • βœ… Typed Form Elements - Semantic chaining (Email("u").Required())

  • βœ… Void Element Rendering - Correct HTML for <br>, <img>, <input>

  • βœ… Fluent Builder API - Chainable methods (dom.Div().ID("x").Class("y"))

  • βœ… Hybrid rendering - Choose DSL or string HTML per component

  • βœ… Lifecycle hooks - OnMount, OnUpdate, OnUnmount

  • βœ… Auto-ID generation - All components get unique IDs automatically

πŸ“Š Performance

Binary Size (TinyGo WASM):

  • Simple counter app: ~35KB (compressed)
  • Todo list with 10 components: ~120KB (compressed)
  • Full application: <500KB (compressed)

Compared to standard library approach: 60-80% smaller binaries.

License

MIT

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

func Append ΒΆ added in v0.2.0

func Append(parentID string, component Component) error

Append injects a component AFTER the last child of the parent element.

func GetHash ΒΆ added in v0.0.11

func GetHash() string

GetHash gets the current hash.

func Log ΒΆ added in v0.0.7

func Log(v ...any)

Log provides logging functionality.

func OnHashChange ΒΆ added in v0.0.11

func OnHashChange(handler func(hash string))

OnHashChange registers a hash change listener.

func Render ΒΆ added in v0.2.0

func Render(parentID string, component Component) error

Render injects a component into a parent element.

func SetHash ΒΆ added in v0.0.11

func SetHash(hash string)

SetHash sets the current hash.

func SetLog ΒΆ added in v0.0.7

func SetLog(log func(v ...any))

SetLog sets the logging function.

func Update ΒΆ added in v0.2.0

func Update(component Component) error

Update re-renders a component.

Types ΒΆ

type CSSProvider ΒΆ added in v0.0.13

type CSSProvider interface {
	RenderCSS() string
}

CSSProvider is an optional capability: components that provide raw CSS for SSR asset collection (collected by tinywasm/site during static build).

type Component ΒΆ

type Component interface {
	GetID() string
	SetID(id string)
	RenderHTML() string
	Children() []Component
}

Component is the minimal interface for components. All components must implement this for both SSR (backend) and WASM (frontend).

type DOM ΒΆ

type DOM interface {
	// Render injecta un componente en un elemento padre.
	// 1. Llama a componente.Render() (si es ViewRenderer) o componente.RenderHTML()
	// 2. Establece el contenido del elemento padre (buscado por parentID)
	// 3. Llama a componente.OnMount() para enlazar eventos
	Render(parentID string, component Component) error

	// Append injecta un componente DESPUÉS del último hijo del elemento padre.
	// Útil para listas dinÑmicas.
	Append(parentID string, component Component) error

	// OnHashChange registra un listener para cambios en el hash de la URL.
	OnHashChange(handler func(hash string))

	// GetHash devuelve el hash actual de la URL (ej. "#help").
	GetHash() string

	// SetHash actualiza el hash de la URL.
	SetHash(hash string)

	// Update re-renderiza el componente en su posiciΓ³n actual en el DOM.
	Update(component Component) error

	// Get retrieves an element by ID.
	Get(id string) (Reference, bool)

	// Log provides logging functionality using the log function passed to New.
	Log(v ...any)
}

DOM is the main entry point for interacting with the browser. It is designed to be injected into your components.

type Element ΒΆ

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

Element represents a DOM element in the fluent Element API.

func A ΒΆ added in v0.2.0

func A(href string, children ...any) *Element

Enhanced factories with key attrs as args

func Article ΒΆ added in v0.4.2

func Article(children ...any) *Element

func Aside ΒΆ added in v0.4.2

func Aside(children ...any) *Element

func Br ΒΆ added in v0.4.2

func Br() *Element

func Button ΒΆ added in v0.2.0

func Button(children ...any) *Element

func Canvas ΒΆ added in v0.4.2

func Canvas(children ...any) *Element

func Code ΒΆ added in v0.4.2

func Code(children ...any) *Element

func Details ΒΆ added in v0.4.2

func Details(children ...any) *Element

func Dialog ΒΆ added in v0.4.2

func Dialog(children ...any) *Element

func Div ΒΆ added in v0.2.0

func Div(children ...any) *Element

func Em ΒΆ added in v0.4.2

func Em(children ...any) *Element

func Fieldset ΒΆ added in v0.4.2

func Fieldset(children ...any) *Element

func Figcaption ΒΆ added in v0.4.2

func Figcaption(children ...any) *Element

func Figure ΒΆ added in v0.4.2

func Figure(children ...any) *Element
func Footer(children ...any) *Element

func H1 ΒΆ added in v0.2.0

func H1(children ...any) *Element

func H2 ΒΆ added in v0.2.0

func H2(children ...any) *Element

func H3 ΒΆ added in v0.2.0

func H3(children ...any) *Element

func H4 ΒΆ added in v0.4.2

func H4(children ...any) *Element

func H5 ΒΆ added in v0.4.2

func H5(children ...any) *Element

func H6 ΒΆ added in v0.4.2

func H6(children ...any) *Element
func Header(children ...any) *Element

func Hr ΒΆ added in v0.4.2

func Hr() *Element

func Img ΒΆ added in v0.2.0

func Img(src, alt string) *Element

Void element factories (void: true, no children)

func Label ΒΆ added in v0.4.2

func Label(children ...any) *Element

func Legend ΒΆ added in v0.4.2

func Legend(children ...any) *Element

func Li ΒΆ added in v0.2.0

func Li(children ...any) *Element

func Main ΒΆ added in v0.4.2

func Main(children ...any) *Element

func Mark ΒΆ added in v0.4.2

func Mark(children ...any) *Element
func Nav(children ...any) *Element

func Ol ΒΆ added in v0.4.2

func Ol(children ...any) *Element

func Option ΒΆ added in v0.4.2

func Option(value, text string) *Element

Option helpers

func P ΒΆ added in v0.2.0

func P(children ...any) *Element

func Pre ΒΆ added in v0.4.2

func Pre(children ...any) *Element

func Script ΒΆ added in v0.4.2

func Script(children ...any) *Element

func Section ΒΆ added in v0.4.2

func Section(children ...any) *Element

func SelectedOption ΒΆ added in v0.4.2

func SelectedOption(value, text string) *Element

func Small ΒΆ added in v0.4.2

func Small(children ...any) *Element

func Span ΒΆ added in v0.2.0

func Span(children ...any) *Element

func Strong ΒΆ added in v0.4.2

func Strong(children ...any) *Element

func Style ΒΆ added in v0.4.2

func Style(children ...any) *Element

func Summary ΒΆ added in v0.4.2

func Summary(children ...any) *Element

func Svg ΒΆ added in v0.5.2

func Svg(children ...any) *Element

func Table ΒΆ added in v0.4.2

func Table(children ...any) *Element

func Tbody ΒΆ added in v0.4.2

func Tbody(children ...any) *Element

func Td ΒΆ added in v0.4.2

func Td(children ...any) *Element

func Tfoot ΒΆ added in v0.4.2

func Tfoot(children ...any) *Element

func Th ΒΆ added in v0.4.2

func Th(children ...any) *Element

func Thead ΒΆ added in v0.4.2

func Thead(children ...any) *Element

func Tr ΒΆ added in v0.4.2

func Tr(children ...any) *Element

func Ul ΒΆ added in v0.2.0

func Ul(children ...any) *Element

func Use ΒΆ added in v0.5.2

func Use(children ...any) *Element

func (*Element) Add ΒΆ added in v0.2.3

func (b *Element) Add(children ...any) *Element

Add adds one or more children to the element. Children can be *Element, Node, Component, or string.

func (*Element) Attr ΒΆ added in v0.2.3

func (b *Element) Attr(key, val string) *Element

Attr sets an attribute on the element.

func (*Element) Children ΒΆ added in v0.2.3

func (b *Element) Children() []Component

Children returns the component's children (components only).

func (*Element) Class ΒΆ added in v0.2.3

func (b *Element) Class(class ...string) *Element

Class adds a class to the element.

func (*Element) GetID ΒΆ added in v0.2.3

func (b *Element) GetID() string

GetID returns the element's ID.

func (*Element) ID ΒΆ added in v0.2.3

func (b *Element) ID(id string) *Element

ID sets the ID of the element.

func (*Element) On ΒΆ

func (b *Element) On(t string, h func(Event)) *Element

On adds a generic event handler.

func (*Element) Render ΒΆ added in v0.2.3

func (b *Element) Render(parentID string) error

Render renders the element to the parent. This is a terminal operation.

func (*Element) RenderHTML ΒΆ added in v0.2.3

func (b *Element) RenderHTML() string

RenderHTML renders the element to HTML string.

func (*Element) SetID ΒΆ added in v0.2.3

func (b *Element) SetID(id string)

SetID sets the element's ID.

func (*Element) Text ΒΆ added in v0.2.3

func (b *Element) Text(text string) *Element

Text adds a text node child.

func (*Element) Update ΒΆ added in v0.3.0

func (b *Element) Update() error

Update triggers a re-render of the component.

type Event ΒΆ

type Event interface {
	// PreventDefault prevents the default action of the event.
	PreventDefault()
	// StopPropagation stops the event from bubbling up the DOM tree.
	StopPropagation()
	// TargetValue returns the value of the event's target element.
	// Useful for input, textarea, and select elements.
	TargetValue() string
	// TargetID returns the ID of the event's target element.
	TargetID() string
	// TargetChecked returns the checked status of the event's target element.
	// Useful for checkbox and radio input elements.
	TargetChecked() bool
}

Event represents a DOM event.

type FormEl ΒΆ added in v0.4.2

type FormEl struct{ *Element }

func Form ΒΆ added in v0.2.0

func Form(children ...any) *FormEl

Factory

func (*FormEl) Action ΒΆ added in v0.4.2

func (f *FormEl) Action(url string) *FormEl

Semantic methods

func (*FormEl) Add ΒΆ added in v0.4.2

func (f *FormEl) Add(children ...any) *FormEl

func (*FormEl) AsElement ΒΆ added in v0.4.2

func (f *FormEl) AsElement() *Element

func (*FormEl) Attr ΒΆ added in v0.4.2

func (f *FormEl) Attr(k, v string) *FormEl

func (*FormEl) Class ΒΆ added in v0.4.2

func (f *FormEl) Class(c ...string) *FormEl

func (*FormEl) ID ΒΆ added in v0.4.2

func (f *FormEl) ID(id string) *FormEl

Shadow methods

func (*FormEl) Method ΒΆ added in v0.4.2

func (f *FormEl) Method(m string) *FormEl

func (*FormEl) NoValidate ΒΆ added in v0.4.2

func (f *FormEl) NoValidate() *FormEl

func (*FormEl) On ΒΆ added in v0.4.2

func (f *FormEl) On(t string, h func(Event)) *FormEl

func (*FormEl) OnSubmit ΒΆ added in v0.4.2

func (f *FormEl) OnSubmit(fn func(Event)) *FormEl

type IconSvgProvider ΒΆ added in v0.0.13

type IconSvgProvider interface {
	IconSvg() map[string]string
}

IconSvgProvider is an optional capability: components that expose SVG icons for the global sprite sheet injected during SSR build.

type InputEl ΒΆ added in v0.4.2

type InputEl struct{ *Element }

func Checkbox ΒΆ added in v0.4.2

func Checkbox(name string, value ...string) *InputEl

func Color ΒΆ added in v0.4.2

func Color(name string) *InputEl

func Date ΒΆ added in v0.4.2

func Date(name string) *InputEl

func Email ΒΆ added in v0.4.2

func Email(name string, placeholder ...string) *InputEl

func File ΒΆ added in v0.4.2

func File(name string) *InputEl

func Hidden ΒΆ added in v0.4.2

func Hidden(name, value string) *InputEl

func Input ΒΆ added in v0.2.0

func Input(inputType string) *InputEl

Base factory

func Number ΒΆ added in v0.4.2

func Number(name string) *InputEl

func Password ΒΆ added in v0.4.2

func Password(name string) *InputEl

func Radio ΒΆ added in v0.4.2

func Radio(name, value string) *InputEl

func Range ΒΆ added in v0.4.2

func Range(name string) *InputEl

func Reset ΒΆ added in v0.4.2

func Reset(value ...string) *InputEl
func Search(name string, placeholder ...string) *InputEl

func Submit ΒΆ added in v0.4.2

func Submit(value ...string) *InputEl

func Tel ΒΆ added in v0.4.2

func Tel(name string, placeholder ...string) *InputEl

func Text ΒΆ added in v0.4.2

func Text(name string, placeholder ...string) *InputEl

Typed factories β€” (name string, placeholder ...string) where applicable

func Url ΒΆ added in v0.4.2

func Url(name string, placeholder ...string) *InputEl

func (*InputEl) AsElement ΒΆ added in v0.4.2

func (i *InputEl) AsElement() *Element

func (*InputEl) Attr ΒΆ added in v0.4.2

func (i *InputEl) Attr(k, v string) *InputEl

func (*InputEl) AutoComplete ΒΆ added in v0.4.2

func (i *InputEl) AutoComplete(v string) *InputEl

func (*InputEl) Checked ΒΆ added in v0.4.2

func (i *InputEl) Checked() *InputEl

func (*InputEl) Class ΒΆ added in v0.4.2

func (i *InputEl) Class(c ...string) *InputEl

func (*InputEl) Disabled ΒΆ added in v0.4.2

func (i *InputEl) Disabled() *InputEl

func (*InputEl) ID ΒΆ added in v0.4.2

func (i *InputEl) ID(id string) *InputEl

Shadow methods β€” preserve *InputEl chain

func (*InputEl) Max ΒΆ added in v0.4.2

func (i *InputEl) Max(v string) *InputEl

func (*InputEl) Min ΒΆ added in v0.4.2

func (i *InputEl) Min(v string) *InputEl

func (*InputEl) Name ΒΆ added in v0.4.2

func (i *InputEl) Name(n string) *InputEl

Semantic methods β€” all return *InputEl

func (*InputEl) On ΒΆ added in v0.4.2

func (i *InputEl) On(t string, h func(Event)) *InputEl

func (*InputEl) Pattern ΒΆ added in v0.4.2

func (i *InputEl) Pattern(p string) *InputEl

func (*InputEl) Placeholder ΒΆ added in v0.4.2

func (i *InputEl) Placeholder(p string) *InputEl

func (*InputEl) Readonly ΒΆ added in v0.4.2

func (i *InputEl) Readonly() *InputEl

func (*InputEl) Required ΒΆ added in v0.4.2

func (i *InputEl) Required(v ...bool) *InputEl

func (*InputEl) Step ΒΆ added in v0.4.2

func (i *InputEl) Step(v string) *InputEl

func (*InputEl) Value ΒΆ added in v0.4.2

func (i *InputEl) Value(v string) *InputEl

type JSProvider ΒΆ added in v0.0.13

type JSProvider interface {
	RenderJS() string
}

JSProvider is an optional capability: components that provide raw JS for SSR asset collection.

type Mountable ΒΆ added in v0.2.0

type Mountable interface {
	OnMount()
}

Mountable is an optional interface for components that need initialization logic.

type Reference ΒΆ added in v0.2.3

type Reference interface {

	// GetAttr retrieves an attribute value.
	GetAttr(key string) string

	// Value returns the current value of an input/textarea/select.
	Value() string

	// Checked returns the current checked state of a checkbox or radio button.
	Checked() bool

	// On registers a generic event handler (e.g., "click", "change", "input", "keydown").
	On(eventType string, handler func(event Event))

	// Focus sets focus to the element.
	Focus()
}

Reference represents a reference to a DOM node. It provides methods for reading and interaction.

func Get ΒΆ added in v0.0.7

func Get(id string) (Reference, bool)

Get retrieves an element by ID.

type SelectEl ΒΆ added in v0.4.2

type SelectEl struct{ *Element }

func Select ΒΆ added in v0.4.2

func Select(name string, children ...any) *SelectEl

Factory: name as first required arg, options as children

func (*SelectEl) Add ΒΆ added in v0.4.2

func (s *SelectEl) Add(children ...any) *SelectEl

func (*SelectEl) AsElement ΒΆ added in v0.4.2

func (s *SelectEl) AsElement() *Element

func (*SelectEl) Attr ΒΆ added in v0.4.2

func (s *SelectEl) Attr(k, v string) *SelectEl

func (*SelectEl) Class ΒΆ added in v0.4.2

func (s *SelectEl) Class(c ...string) *SelectEl

func (*SelectEl) Disabled ΒΆ added in v0.4.2

func (s *SelectEl) Disabled() *SelectEl

func (*SelectEl) ID ΒΆ added in v0.4.2

func (s *SelectEl) ID(id string) *SelectEl

Shadow methods

func (*SelectEl) Multiple ΒΆ added in v0.4.2

func (s *SelectEl) Multiple() *SelectEl

func (*SelectEl) Name ΒΆ added in v0.4.2

func (s *SelectEl) Name(n string) *SelectEl

Semantic methods

func (*SelectEl) On ΒΆ added in v0.4.2

func (s *SelectEl) On(t string, h func(Event)) *SelectEl

func (*SelectEl) Required ΒΆ added in v0.4.2

func (s *SelectEl) Required(v ...bool) *SelectEl

type TextareaEl ΒΆ added in v0.4.2

type TextareaEl struct{ *Element }

func Textarea ΒΆ added in v0.4.2

func Textarea(name string, placeholder ...string) *TextareaEl

Factory: (name, placeholder) β€” defaults to rows="3"

func (*TextareaEl) AsElement ΒΆ added in v0.4.2

func (t *TextareaEl) AsElement() *Element

func (*TextareaEl) Attr ΒΆ added in v0.4.2

func (t *TextareaEl) Attr(k, v string) *TextareaEl

func (*TextareaEl) Class ΒΆ added in v0.4.2

func (t *TextareaEl) Class(c ...string) *TextareaEl

func (*TextareaEl) Cols ΒΆ added in v0.4.2

func (t *TextareaEl) Cols(n int) *TextareaEl

func (*TextareaEl) ID ΒΆ added in v0.4.2

func (t *TextareaEl) ID(id string) *TextareaEl

Shadow methods

func (*TextareaEl) MaxLength ΒΆ added in v0.4.2

func (t *TextareaEl) MaxLength(n int) *TextareaEl

func (*TextareaEl) Name ΒΆ added in v0.4.2

func (t *TextareaEl) Name(n string) *TextareaEl

Semantic methods

func (*TextareaEl) On ΒΆ added in v0.4.2

func (t *TextareaEl) On(ev string, h func(Event)) *TextareaEl

func (*TextareaEl) Placeholder ΒΆ added in v0.4.2

func (t *TextareaEl) Placeholder(p string) *TextareaEl

func (*TextareaEl) Readonly ΒΆ added in v0.4.2

func (t *TextareaEl) Readonly() *TextareaEl

func (*TextareaEl) Required ΒΆ added in v0.4.2

func (t *TextareaEl) Required(v ...bool) *TextareaEl

func (*TextareaEl) Rows ΒΆ added in v0.4.2

func (t *TextareaEl) Rows(n int) *TextareaEl

func (*TextareaEl) Value ΒΆ added in v0.4.2

func (t *TextareaEl) Value(v string) *TextareaEl

type Unmountable ΒΆ added in v0.2.0

type Unmountable interface {
	OnUnmount()
}

Unmountable is an optional interface for components that need cleanup logic.

type Updatable ΒΆ added in v0.2.0

type Updatable interface {
	OnUpdate()
}

Updatable is an optional interface for components that need update logic.

type ViewRenderer ΒΆ added in v0.2.0

type ViewRenderer interface {
	Render() *Element
}

ViewRenderer returns a Node tree for declarative UI.

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

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