Component Detail

Form

Form element wrapper for method/action and child controls.

Example

References

Template
components.go
Golden
N/A

Go (Marionette) Example

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

package goexamples

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

// RegisterFormExample wires a Marionette page used in docs snippets.
func RegisterFormExample(app *mb.App) {
	app.Page("/form", func(ctx *mb.Context) mf.Node {
		return mf.Form("/users",
			mf.FormField(
				mf.Input("name", "", mf.ComponentProps{}),
				mf.FormFieldProps{Label: "Name", Required: true, Hint: "Enter a display name."},
			),
			mf.SubmitButton("Create user", mf.ComponentProps{Variant: "primary"}),
		)
	})
}