Documentation
¶
Index ¶
- Variables
- func Mount(el Component)
- func MountFn(fn func(ctx *RenderContext) Component)
- func UseEffect(ctx *RenderContext, fn func(), deps []any)
- func UseState[T any](ctx *RenderContext, initial T) (T, func(next T))
- type Component
- type Container
- type Control
- type Fragment
- type Node
- type RenderContext
- type RenderFn
- type Unmountable
Constants ¶
This section is empty.
Variables ¶
var RunOnMainLoop func(func()) = func(_ func()) { panic("RunOnMainLoop not set up.") }
Functions ¶
func Mount ¶
func Mount(el Component)
Mount renders a component into a tree of controls and mounts it into the UI. This is a shortcut for `Build(el).Mount()`.
func MountFn ¶
func MountFn(fn func(ctx *RenderContext) Component)
MountFn creates a component from a render function, builds it into a tree of controls, and mounts it into the UI. This is a shortcut for `Build(Make(fn)).Mount()`.
func UseEffect ¶
func UseEffect(ctx *RenderContext, fn func(), deps []any)
func UseState ¶
func UseState[T any](ctx *RenderContext, initial T) (T, func(next T))
Types ¶
type Component ¶
type Component interface {
Render(ctx *RenderContext) Component
}
type Container ¶
type Container interface {
Control
BuildNode(ctx *RenderContext) Node // BuildNode renders the control and its children into tree of nodes.
}
Container is a control component that owns other controls.
type Fragment ¶
type Fragment []Component
func Range ¶
func Range[T float64 | int | uint](ctx *RenderContext, start, end T, f func(ctx *RenderContext, idx T) Component) Fragment
func (Fragment) Render ¶
func (l Fragment) Render(ctx *RenderContext) Component
type Node ¶
func Build ¶
Build renders a component into a tree of controls. This tree can be mounted to display the UI.
type RenderContext ¶
type RenderContext struct {
// contains filtered or unexported fields
}
func (*RenderContext) BuildNode ¶
func (ctx *RenderContext) BuildNode(component Component) Node
BuildNode recursively renders a component and its children into a tree of UI controls.
func (*RenderContext) Make ¶
func (ctx *RenderContext) Make(render func(*RenderContext) Component) Node
func (*RenderContext) TriggerUpdate ¶
func (ctx *RenderContext) TriggerUpdate()
type RenderFn ¶
type RenderFn = func(ctx *RenderContext) Component
type Unmountable ¶
type Unmountable interface {
Control
Unmount()
}
Unmountable is a control component that can be unmounted from the UI tree again.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
circles
command
|
|
|
custom-components
command
|
|
|
editor
command
|
|
|
hello-spot
command
|
|
|
hello-world
command
|
|
|
internal/cocoa
Package cocoa - Go bindings for the Cocoa framework.
|
Package cocoa - Go bindings for the Cocoa framework. |
