NavLink

A link to a page of the site, a row of a NavTree: its name, an optional note beside it, and a fill when it is the current page.

A link to a page of the site, a row of a NavTree: its name, an optional note beside it, and a fill when it is the current page. It is a plain anchor - the keyboard follows it as any link - and the current page is marked aria-current="page". An external link opens in a tab of its own, noopener noreferrer, and carries an arrow after its name so it is not taken for a page of the site.

<NavLink href="/components/button/" isCurrent>Button</NavLink>
<NavLink href="/markdown/" note="v1.2.3">Markdown</NavLink>
<NavLink href="https://github.com/soroush-tech" isExternal>Source</NavLink>

Demos

For usage examples, visit the component demo page: NavTree

Import

import { NavLink } from '@soroush.tech/design-system/NavTree'

Props

Also accepts every attribute of an a - they win over what isExternal sets.

PropTypeDefaultDescription
hrefstring-Where it goes.
childrenReactNode-The name of the page.
isCurrentbooleanfalseThe page the reader is on: aria-current="page", filled.
noteReactNode-A short note beside the name - a version, a count.
isExternalbooleanfalseThe page is outside the site: a tab of its own, with an arrow after it.
colorkeyof Theme['palette']its NavTree'sColor of the pill and the focus ring.

Theming

SlotElement
rootThe anchor.
labelThe name.
noteThe note.

Customize via theme.components.NavLink.styleOverrides.

Source code

If this page does not answer your question, have a look at the implementation of the component for more detail.