PrimaryNavItem

A primary navigation element for sidebars.

import React, { useState } from 'react';
import { PrimaryNavItem } from '@minddrop/ui';
export const PrimaryNavItemDemo = () => {
const [active, setActive] = useState('daily-drops');
return (
<div style={{ width: 260, display: 'flex', flexDirection: 'column', rowGap: 2, padding: '12px 6px', borderRadius: 'var(--radiusMd)', backgroundColor: 'var(--bgApp)', }} >
<PrimaryNavItem label="Daily drops" icon="drop" active={active === 'daily-drops'} onClick={() => setActive('daily-drops')} />
<PrimaryNavItem label="Search" icon="search" active={active === 'search'} onClick={() => setActive('search')} />
<PrimaryNavItem label="Settings" icon="settings" active={active === 'settings'} onClick={() => setActive('settings')} />
</div>
);
};
export default PrimaryNavItemDemo;

Features

  • Full keyboard navigation.
  • Applies aria-current="location" when active for accsesibility.

Import the component from the @minddrop/ui package.

import { PrimaryNavItem, Icon } from '@minddrop/ui';
export default () => {
return <PrimaryNavItem label="Search" icon="search" />;
};

PrimaryNavItemProps extends React.HTMLAttributes<HTMLDivElement>.

PropTypeDefault
label*nodeNo default value
icon*IconName | ReactElementNo default value
activebooleanNo default value
onClickfunctionNo default value

Adheres to the Button WAI-ARIA design pattern.

KeyDescription
SpaceActivates the item.
EnterActivates the item.