コンポーネント詳細
Form
Form element wrapper for method/action and child controls.
サンプル
参照情報
- テンプレート
components.go- ゴールデン
N/A
Go(Marionette)サンプル
この実装例は Go の Marionette を使っています。ソース: 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"}),
)
})
}