Component Detail
Switch
Toggle-style boolean switch control
Example
References
- Template
templates/components/switch.html- Golden
testdata/golden/switch.golden.html
Go (Marionette) Example
This implementation example uses Marionette in Go. Source: docs/site-astro/public/examples/go/switch.go
package goexamples
import (
mb "github.com/YoshihideShirai/marionette/backend"
mf "github.com/YoshihideShirai/marionette/frontend"
)
func RegisterSwitchExample(app *mb.App) {
app.Page("/switch", func(ctx *mb.Context) mf.Node {
return mf.Switch(mf.SwitchComponentProps{
Name: "notifications",
Value: "enabled",
Label: "Enable notifications",
Checked: true,
})
})
}