Component Detail

RadioGroup

Exclusive multi-option radio selection group

Example

References

Template
templates/components/radio_group.html
Golden
testdata/golden/radio_group.golden.html

Go (Marionette) Example

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

package goexamples

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

func RegisterRadioGroupExample(app *mb.App) {
	app.Page("/radio-group", func(ctx *mb.Context) mf.Node {
		return mf.RadioGroup(mf.RadioGroupComponentProps{
			Name:      "role",
			AriaLabel: "Role",
			Items: []mf.RadioItem{
				{Label: "Admin", Value: "admin"},
				{Label: "Viewer", Value: "viewer", Checked: true},
			},
		})
	})
}