Creating and using elements

Creating and Using Elements

gofh provides functions for all standard HTML elements:

gofh.Div(
    gofh.H1("Header"),
    gofh.P("Paragraph"),
    gofh.Ul(
        gofh.Li("Item 1"),
        gofh.Li("Item 2"),
    ),
)

You can also create custom elements:

func CustomCard(title, content string) gofh.Element {
    return gofh.Div(
        gofh.H2(title),
        gofh.P(content),
    ).Class("card")
}

Last updated