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;
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>
.
Prop | Type | Default |
---|---|---|
label* | node | |
icon* | IconName | ReactElement | |
active | boolean | |
onClick | function |
Adheres to the Button WAI-ARIA design pattern.
Key | Description |
---|---|
Space | Activates the item. |
Enter | Activates the item. |