Skip to content
This repository has been archived by the owner on Dec 21, 2020. It is now read-only.

golangee/forms-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wtk-example

wtk kitchen sink demo. It is inspired by the SwiftUI tutorial. The only available implementation is WTK with a WASM HTML core.

Section 1

A View must comply to the View interface. It cannot be implemented entirely by your own, because it contains some hidden implementation specific contracts. You have to implement a View interface by embedding an existing view or container. By convention, you should always provide a factory method prefixed with New followed by your views name.

package section1

import . "github.com/golangee/forms"

type ContentView struct {
	*Text
}

func NewContentView() *ContentView {
	return &ContentView{Text: NewText("hello world")}
}

Section 2

You can style your View in a fluent way, using the predefined parameters.

package section2

import . "github.com/golangee/forms"

type ContentView struct {
	*Text
}

func NewContentView() *ContentView {
	return &ContentView{
		Text: NewText("Turtle Rock").
			Style(
				ForegroundColor(Green),
				Font(Title),
			),
	}
}