SecondaryNavItem

A secondary navigation element for sidebars.

import React, { useState } from 'react';
import { SecondaryNavItem } from '@minddrop/ui';
export const SecondaryNavItemDemo = () => {
const [active, setActive] = useState('extensions');
return (
<div style={{ width: 260, display: 'flex', flexDirection: 'column', rowGap: 2, padding: '12px 6px', borderRadius: 'var(--radiusMd)', backgroundColor: 'var(--bgApp)', }} >
<SecondaryNavItem label="Extensions" icon="extension" active={active === 'extensions'} onClick={() => setActive('extensions')} />
<SecondaryNavItem label="Archive" icon="archive" active={active === 'archive'} onClick={() => setActive('archive')} />
<SecondaryNavItem label="Trash" icon="trash" active={active === 'trash'} onClick={() => setActive('trash')} />
</div>
);
};
export default SecondaryNavItemDemo;

Features

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

Import the component from the @minddrop/ui package.

import { SecondaryNavItem, Icon } from '@minddrop/ui';
export default () => {
return <SecondaryNavItem label="Trash" icon="trash" />;
};

SecondaryNavItemProps 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.