Component Detail
Link
Internal, external, and download links with shared styling.
Example
References
- Template
templates/components/link.tmpl- Golden
testdata/golden/link.golden.html
Go (Marionette) Example
This implementation example uses Marionette in Go. Source: docs/site-astro/public/examples/go/link.go
package goexamples
import (
mb "github.com/YoshihideShirai/marionette/backend"
mf "github.com/YoshihideShirai/marionette/frontend"
)
func RegisterLinkExample(app *mb.App) {
app.Page("/link", func(ctx *mb.Context) mf.Node {
return mf.Actions(mf.ActionsProps{Gap: "sm", Wrap: true},
mf.Link(mf.LinkProps{
Label: "View dashboard",
Href: "/dashboard",
}),
mf.ExternalLink("Open docs", "https://example.com/docs", mf.ComponentProps{}),
mf.ExternalIconLink("↗", "Open docs in a new tab", "https://example.com/docs", mf.ComponentProps{
Variant: "ghost",
Size: "sm",
}),
mf.DownloadLink("Download CSV", ctx.Asset("reports/users.csv"), "users.csv", mf.ComponentProps{
Variant: "primary",
Size: "sm",
}),
)
})
}