Duolith docs

TabBarItem

One tab of a TabBar: a link with an icon over a label, and an optional badge count, current while the route is inside it.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringThe tab's name, shown under the icon.
iconstringAn icon from the built-in set.
hrefstringThe route the tab opens. Pressing it switches screens with a crossfade, and starts a part of the app: the screen it opens has no back button. Matched without its query, fragment or trailing slash, decoded.
badgenumberA count on the icon, such as unread messages; none when 0 or left out, 99+ above 99.
exactbooleanfalseCurrent only at href itself, not at the routes below it. href="/" is always matched exactly.
currentbooleanOverrides the matching, for a tab that owns routes outside its href, such as a feed whose posts open at /post/7.

States

StateLooks like
currentIcon and label in the primary colour; muted otherwise.
pressedThe icon scales to 92%.
focusedA 2px primary outline inside the tab.
badgeA danger-coloured pill at the icon's top trailing corner, ringed with the bar's surface.

Accessibility

rolelink
nameThe label, then ", 3 new" while the badge is above 0.
focusTab reaches it; it is an ordinary link.
keyboardEnter follows it.
notesWhile current it has aria-current="page"; otherwise no aria-current at all. Matching follows the route as it changes: by default, current at href and at any path below it (/inbox matches /inbox/7, not /inboxes).

Theme tokens

color.muted color.primary color.danger color.on-primary color.surface space.1 radius.md radius.full text.caption

Example

<TabBarItem label="Inbox" icon="inbox" href="/inbox" badge={unread.length} />