builder

package
v0.0.0-...-356c069 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package builder provides helpers for constructing VNodes

A common pattern is to define shorthands for these in the package that does your app's rendering. For example:

``` import (

"zenhack.net/go/tea/vdom"
"zenhack.net/go/tea/vdom/builder"

)

type (

a = builder.A
e = builder.E

)

var (

h = builder.H
t = builder.T

)

func view() vdom.VNode {
	return h("a", a{"href": "/"}, nil, t("home"))
}

```

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func H

func H(tag string, attrs A, events E, children ...vdom.VNode) vdom.VNode

H constructs a vdom.VElem node with the given tag, attributes, event handlers, and child nodes. Either attrs or events or both may be nil.

func T

func T(text string) vdom.VNode

T constructs a vdom.VText node with the given text.

Types

type A

type A map[string]string

An A is a map of attribute names to values.

type E

type E map[string]vdom.EventHandler

An E is a map of event names to event handlers.

Jump to

Keyboard shortcuts

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