Skip to content

FieldSet

A fieldset is a layout type that directly maps to HTML's <fieldset> type see more.

It behaves identically to other layouts like a grid, but all content is wrapped inside a bordered area with a label present in the top left.

You can create a fieldset as so:

go
FieldSet("my-fieldset")

Common Methods

For a list of common layout component methods, see here.

Label

You can specify the label present in your fieldset as so:

go
// static
FieldSet("my-fieldset").
    Label("My Fields!")

// callback
FieldSet("my-fieldset").
    LabelFn(
        func (ctx FieldContext) string {
            return "My Field Set"
        }
    )

Hide Border

You can hide the border of your field set as so (though perhaps just use a grid?):

go
// static
FieldSet("my-fieldset").
    HideBorder()

// callback
FieldSet("my-fieldset").
    HideBorderFn(
        func (ctx FieldContext) bool {
            return false
        }
    )

Released under the MIT License.