Component Detail

Alert

Inline alert message component

Example

References

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

Go (Marionette) Example

This implementation example uses Marionette in Go. Source: 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"},
		})
	})
}