コンポーネント詳細

Toast

Transient toast notification component

サンプル

参照情報

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

Go(Marionette)サンプル

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

package goexamples

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

// RegisterToastExample wires a Marionette page used in docs snippets.
func RegisterToastExample(app *mb.App) {
	app.Page("/toast", func(ctx *mb.Context) mf.Node {
		return mf.Toast(mf.ToastProps{
			Title:       "Settings saved",
			Description: "Your workspace preferences were updated.",
			Icon:        "OK",
			Props:       mf.ComponentProps{Variant: "success"},
		})
	})
}