Version: v1.0.0 Latest Latest

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

Go to latest
Published: Feb 12, 2016 License: Apache-2.0 Imports: 6 Imported by: 0



Package html provides functions to build up the DOM of an app.



This section is empty.


This section is empty.


func Render

func Render(view Viewer, rootUpdateFunc interface{})

Render renders a view and writes it to the DOM.


type HTML

type HTML struct {
	// contains filtered or unexported fields

HTML defines an HTML element.

func Button

func Button(s HTML) HTML

Button creates an HTML <button>.

func Div

func Div(s ...HTML) HTML

Div creates an HTML <div>.

func Input

func Input(s string) HTML

Input creates an HTML <input>.

func Label

func Label(s string) HTML

Label creates an HTML <label>

func Text

func Text(s string) HTML

Text creates an HTML text string. Quoting and XSS prevention will be added later.

func (*HTML) ID

func (s *HTML) ID() string

ID returns the current HTML ID of this element (assigning if necessary).

func (HTML) On

func (s HTML) On(event string, rootUpdateFunc, updateFunc, actionFunc interface{}) HTML

On adds an event handler to an HTML element.

func (HTML) OnClick

func (s HTML) OnClick(rootUpdateFunc, updateFunc, actionFunc interface{}) HTML

OnClick adds an click handler to an HTML element.

func (HTML) OnKeypress

func (s HTML) OnKeypress(rootUpdateFunc, updateFunc, actionFunc interface{}) HTML

OnKeypress adds a keypress handler to an HTML element.

func (HTML) Props

func (s HTML) Props(props [][]string) HTML

Props adds a slice of properties to an HTML element.

func (HTML) Render

func (s HTML) Render() (string, []func())

Render renders the HTML element into its string representation. It also surfaces all initFuncs to the top and returns them.

func (HTML) Style

func (s HTML) Style(styles [][]string) HTML

Style adds a slice of inline CSS styles to an HTML element.

type Viewer

type Viewer interface {
	View(rootUpdateFunc, updateFunc interface{}) HTML

A Viewer implements a View that renders to HTML.

Source Files

Jump to

Keyboard shortcuts

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