Skip to content
/ m Public

Package m is an HTML element builder and renderer, inspired by Mithril.js

License

Notifications You must be signed in to change notification settings

layeh/m

Repository files navigation

m GoDoc

Package m is an HTML element builder and renderer, inspired by Mithril.js.

package m_test

import (
	"fmt"

	. "layeh.com/m"
)

type Alert struct {
	child Element
}

func NewAlert(child Element) *Alert {
	return &Alert{
		child: child,
	}
}

func (e *Alert) Element() Element {
	return M("div.alert.alert-primary[role=alert]",
		e.child,
	)
}

func ExampleElement() {
	el := NewAlert(T("Access Denied"))
	fmt.Println(RenderString(el))
	// Output:
	// <div class="alert alert-primary" role="alert">Access Denied</div>
}

License

Public domain

Author

Tim Cooper (tim.cooper@layeh.com)

About

Package m is an HTML element builder and renderer, inspired by Mithril.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages