コンポーネント詳細

Checkbox

Boolean checkbox input with label

サンプル

参照情報

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

Go(Marionette)サンプル

この実装例は Go の Marionette を使っています。ソース: docs/site-astro/public/examples/go/checkbox.go

package goexamples

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

func RegisterCheckboxExample(app *mb.App) {
	app.Page("/checkbox", func(ctx *mb.Context) mf.Node {
		return mf.Checkbox(mf.CheckboxComponentProps{
			Name:    "send_invite",
			Value:   "yes",
			Label:   "Send invite email",
			Checked: true,
		})
	})
}