Documentation ¶
Overview ¶
templ: version: v0.2.778
Index ¶
Examples ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func C ¶
Example ¶
package main import ( "context" "os" "github.com/jfbus/templ-components/components/toast" ) func main() { c := toast.C(toast.D{ ContainerID: "toasts", Style: toast.StyleError, Content: "An error occurred !", }) _ = c.Render(context.TODO(), os.Stdout) }
Output:
func Retarget ¶
Retarget returns a HTMX response that retargets the response to display the response to the toast container, ignoring the initial target. When using error status codes, do not forget to add your error codes to the list of codes for which HTMX swaps the content - https://htmx.org/docs/#requests
Types ¶
type D ¶
type D struct { // ContainerID is the ID of the container.C where the toast will be added. //playground:default:"toasts" ContainerID string // Style defines the toast style. Style style.Style // Icon defines an optional icon. StyleOK/StyleWarning/StyleError include a default icon // that can be overriden. Icon string // Content defines the text content of the toast. // You may also define a custom child content : // @toast.C(toast.D{}){ // // your custom content // } Content string Close Close // AutoCloseDelay defines the close delay (default 5s). AutoCloseDelay time.Duration // CustomStyle defines a custom style. // style.Custom{ // "toast": style.D{style.Add("...")}, // "toast/icon": style.D{style.Add("...")}, // } CustomStyle style.Custom // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.