ui

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package ui provides the preferred public component API for GoWebComponents.

It exposes:

  • CreateElement for component composition
  • Render for browser mounting
  • UseState, UseEffect, UseMemo, UseRef, and UseId for local stateful logic
  • UseEvent for typed event handler wrapping

The ui package is the recommended replacement for the older dom/hooks/render split when authoring new components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(root Node, selector string)

func UseCallback

func UseCallback[T any](fn T, deps ...interface{}) T

func UseEffect

func UseEffect(effect func() func(), deps ...interface{})

func UseId

func UseId() string

func UseMemo

func UseMemo[T any](compute func() T, deps ...interface{}) T

Types

type ChangeEvent

type ChangeEvent = runtime.GoEvent

type Event

type Event = runtime.GoEvent

type FocusEvent

type FocusEvent = runtime.GoEvent

type FormEvent

type FormEvent = runtime.GoEvent

type Handler

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

func RawHandler

func RawHandler(value interface{}) Handler

func UseEvent

func UseEvent(fn interface{}) Handler

func (Handler) Value

func (h Handler) Value() interface{}

type InputEvent

type InputEvent = runtime.GoEvent

type KeyboardEvent

type KeyboardEvent = runtime.GoEvent

type MouseEvent

type MouseEvent = runtime.GoEvent

type Node

type Node = *runtime.Element

func CreateElement

func CreateElement(component interface{}, props ...interface{}) Node

func Fragment

func Fragment(children ...Node) Node

func Text

func Text(content string) Node

type Ref

type Ref[T any] struct {
	// contains filtered or unexported fields
}

func UseRef

func UseRef[T any](initialValue T) Ref[T]

func (Ref[T]) Get

func (r Ref[T]) Get() T

func (Ref[T]) Set

func (r Ref[T]) Set(value T)

type State

type State[T any] struct {
	// contains filtered or unexported fields
}

func UseState

func UseState[T any](initialValue T) State[T]

func (State[T]) Get

func (s State[T]) Get() T

func (State[T]) Set

func (s State[T]) Set(value T)

func (State[T]) Update

func (s State[T]) Update(fn func(T) T)

Jump to

Keyboard shortcuts

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