Navigation — Vivid Component
Component for primary navigation in applications, providing different variants for different types of navigation complexity.
Installation
$ yarn add @rexlabs/button
Usage
import {
useNavigation,
NavigationProvider,
Breakpoints,
Menu,
SubMenu,
Navigation,
TopBar
} from '@rexlabs/navigation';
Upgrade Guide
Version 1.x to 2.0.0
Updated components
TopTierNavigation- Removed and replaced by theMenucomponentSecondTierNavigation- Removed and replaced by theSubMenucomponentTwoTierNavigation- Removed and replaced by theNavigationcomponent
Updated props
items- API is slightly different, the main differences being theisTitleandisHeadingattributes are removed- Headings are now defined within the the
itemsby using theSubSectiontype, with the heading defined by thelabelattribute of that section (see newitemtypes below)
- Headings are now defined within the the
Added props
Title- TheNavigationcomponent now has aTitleprop that will handle the rendering of the title part of the menu (previously handled by anitemwith theisTitleattribute)
Updated types
// New item types
interface SubItem {
to?: RouteDefinition;
label: string;
activeMatches?: RouteDefinition[];
onClick?: () => void;
Icon?: ComponentType<any>;
Suffix?: ComponentType<any>;
}
interface SubSection {
label: string;
items: SubItem[];
Icon?: ComponentType<any>;
Suffix?: ComponentType<any>;
}
type SubItems = (SubItem | SubSection)[];
interface Item {
id: string;
label: string;
to?: RouteDefinition;
isBottom?: boolean;
subItems?: SubItems;
activeMatches?: RouteDefinition[];
Icon: ComponentType<any>;
}
Legal
Copyright (c) 2020 Rex Software All Rights Reserved.