htmgo/examples/simple-auth/ui/error.go
maddalax 8736c00fd5
htmgo - custom formatter (#47)
* format htmgo elements on save

* formatter updates

* ensure we maintain comments
2024-10-25 10:33:48 -05:00

20 lines
362 B
Go

package ui
import "github.com/maddalax/htmgo/framework/h"
func FormError(error string) *h.Element {
return h.Div(
h.Id("form-error"),
h.Text(error),
h.If(
error != "",
h.Class("p-4 bg-rose-400 text-white rounded"),
),
)
}
func SwapFormError(ctx *h.RequestContext, error string) *h.Partial {
return h.SwapPartial(ctx,
FormError(error),
)
}