コンポーネント詳細

Alert

Inline alert message component

サンプル

参照情報

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

Go(Marionette)サンプル

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

package goexamples

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

// RegisterAlertExample wires a Marionette page used in docs snippets.
func RegisterAlertExample(app *mb.App) {
	app.Page("/alert", func(ctx *mb.Context) mf.Node {
		return mf.Alert(mf.AlertProps{
			Title:       "Payment failed",
			Description: "Please verify your card and try again.",
			Icon:        "!",
			Props:       mf.ComponentProps{Variant: "error"},
		})
	})
}