The current page's place in the site hierarchy, with links to each level above it.
Mirrors Breadcrumbs from @digdir/designsystemet-react.
Breadcrumbs.new { label = "Du er her:" }
|> Breadcrumbs.withBackLink { label = "Tilbake til Saker" }
|> Breadcrumbs.view []
[ Breadcrumbs.link [ Attr.href "/" ] [ Html.text "Forside" ]
, Breadcrumbs.link [ Attr.href "/saker" ] [ Html.text "Saker" ]
, Breadcrumbs.link [ Attr.href "/saker/42" ] [ Html.text "Sak 42" ]
]The last link is the current page. designsystemet-web marks it with
aria-current="page".
Wide screens show the whole trail. Narrow screens show only the back link from
withBackLink, if there is one.
<Breadcrumbs aria-label="Du er her:"> → Breadcrumbs.new { label = "Du er her:" }<Breadcrumbs.List> + Item + Link → Breadcrumbs.link [ Attr.href "…" ] […] in view<Breadcrumbs.Link aria-label="Tilbake til …"> → Breadcrumbs.withBackLink { label = "Tilbake til …" }<Breadcrumbs.Link aria-label="…"> → Breadcrumbs.backOnly { label = "…" } [ Attr.href "…" ] […]aria-label is required: there is no Norwegian default.Don't set role, aria-current on the links, or (after the first render)
aria-label. The web layer removes aria-label on narrow screens, where only
the back link shows, and Elm only writes it again if you change it.
Breadcrumbs with a name for screen readers, like "Du er her:".
Add a link to the level above the current page (the second-to-last link).
Narrow screens show it instead of the trail. It has that link's text; label
is what screen readers announce, like "Tilbake til Saker".
With fewer than two links, no back link is rendered.
A <ds-breadcrumbs class="ds-breadcrumbs">. List the links from the top
level down to the current page.
Only a link to the level above, on every screen size, for pages without a trail.
Breadcrumbs.backOnly { label = "Tilbake til Saker" }
[ Attr.href "/saker" ]
[ Html.text "Saker" ]The attributes and children go on the link. label is its screen-reader name.
One level in the trail.
Breadcrumbs being configured. Start with
new, finish withview.