4. Low-level HTML (frontend/html)
Low-level HTML constructors live in github.com/YoshihideShirai/marionette/frontend/html.
They are intended for advanced users and component internals. The frontend
package exposes component APIs; use the mh import shown above for custom markup.
type Node interface { Render() (template.HTML, error) }
- Every UI node renders itself to safe HTML.
- Rendering failure eventually becomes
500 Internal Server Errorin HTTP responses.
Basic node constructors
Text(v string) NodeRaw(html string)(type Raw string, trusted HTML passthrough)type Attrs map[string]stringtype ElementProps struct { ID string; Class string; Attrs Attrs }Element(tag string, props ElementProps, children ...Node) NodeDiv(children ...Node) NodeDivID(id string, children ...Node) NodeDivClass(className string, children ...Node) NodeDivAttrs(attrs Attrs, children ...Node) NodeDivProps(props ElementProps, children ...Node) NodeH1(children ...Node) Node/H1Props(props ElementProps, children ...Node) NodeH2(children ...Node) Node/H2Props(props ElementProps, children ...Node) NodeH3(children ...Node) Node/H3Props(props ElementProps, children ...Node) NodeH4(children ...Node) Node/H4Props(props ElementProps, children ...Node) NodeColumn(children ...Node) Node
Table / layout helpers
HTMXTable(headers []string, rows ...TableRowData) NodeTableRow(cells ...Node) TableRowDataSidebar(brand, title string, items ...SidebarItem) *sidebarSidebarLink(label, href string) SidebarItem(SidebarItem).Active() SidebarItem(*sidebar).Note(title, text string) *sidebar
Legacy form/button nodes
Form(action string, children ...Node) *form- default target selector:
#app. - rendered attrs include
hx-post,hx-target,hx-swap="outerHTML".
- default target selector:
(*form).Target(selector string) *formInput(name, value string) NodeFileUpload(name string, required bool) NodeHiddenInput(name, value string) NodeSubmit(label string) NodeButton(label string) *button- default target selector:
#app.
- default target selector:
(*button).Post(action string) *button(action normalized without leading/)(*button).OnClick(action string) *button(Postalias)(*button).Target(selector string) *button(*button).TargetSelector(selector string) *button