Component Detail

FormField

Labeled field wrapper with hint and error text

Example

References

Template
templates/components/form_field.html
Golden
testdata/golden/form_field.golden.html

Go (Marionette) Example

This implementation example uses Marionette in Go. Source: docs/site-astro/public/examples/go/form-field.go

package goexamples

import (
	mb "github.com/YoshihideShirai/marionette/backend"
	mf "github.com/YoshihideShirai/marionette/frontend"
)

func RegisterFormFieldExample(app *mb.App) {
	app.Page("/form-field", func(ctx *mb.Context) mf.Node {
		return mf.FormField(
			mf.InputWithOptions("email", "", mf.InputOptions{Placeholder: "team@example.com"}),
			mf.FormFieldProps{Label: "Email", Required: true, Hint: "Use your work email."},
		)
	})
}