A styled link.
Mirrors Link from @digdir/designsystemet-react.
Link.view [ Attr.href "/saker/42" ] [ Html.text "Se saken" ]With an icon, wrap the text in a <span> so the CSS can space them:
Link.view [ Attr.href "mailto:[email protected]" ]
[ mailIcon, Html.span [] [ Html.text "Send e-post" ] ]<Link href="…"> → Link.view [ Attr.href "…" ]data-color="neutral" → Ds.color Color.neutralasChild + <button> → Link.viewAs Html.button [ Attr.type_ "button" ]Link styling on another element (React's asChild).
Link.viewAs Html.button
[ Attr.type_ "button", Events.onClick ShowTerms ]
[ Html.text "Vilkår" ]Use a real <a href> for navigation. A button is for actions styled as links.
An
<a class="ds-link">. Give it anhref, or keyboards and assistive technology won't treat it as a link.