UI.Link
is just a unified-type for both Element.link
and `Element.newTabLink
For a pratical example see Link.wrapElement
.
The Link msg
type is used for describing the component for later rendering.
link : String -> Link
Builds a link to some desired URL path.
Link.link "https://www.googgle.com"
The LinkTarget
is equivalent to HTML anchor's target.
withTarget : LinkTarget -> Link -> Link
Modify the link behaviour to open the URL in the same tab or a new one.
Link.link "https://www.googgle.com"
|> Link.withTarget Link.targetNew
targetNew : LinkTarget
LinkTarget
value for opening the link in a new tab.
Link.withTarget Link.targetNew someLink
targetRedirect : LinkTarget
LinkTarget
value for opening the link in the same tab.
Link.withTarget Link.targetRedirect someLink
NOTE: This is the default behaviour.
wrapElement : UI.RenderConfig.RenderConfig -> List (Element.Attribute msg) -> Link -> Element msg -> Element msg
Link.wrapElement
is similar to Element.el
but including the anchor linking behaviour.
Link.wrapElement renderConfig
[ Element.centerX, Element.centerY ]
(Link.link "https://www.github.com")
someOtherElement