コンポーネント詳細

FormField

Labeled field wrapper with hint and error text

サンプル

参照情報

テンプレート
templates/components/form_field.html
ゴールデン
testdata/golden/form_field.golden.html

Go(Marionette)サンプル

この実装例は Go の Marionette を使っています。ソース: 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."},
		)
	})
}