rad-nav
v0.2.2
Published
A navigation bar so rad you won't know what to do with all that spare time
Downloads
2
Readme
rad-nav
A navigation bar so rad you won't know what to do with all that spare time
Example
You can easily play with an example live on CodeSandbox
Features
- Mobile friendly
- Renders into an app-like drawer system when active on smaller screens
- Simple styling
- Exposes sane classes so you can style it like you would any normal elements
- Render arbitrary custom components
- See custom rendering section for details
Setup
yarn add rad-nav
Using
import { RadNav } from 'rad-nav'
const menu = {
label: "Root",
items: [
{
label: "Sub Menu",
items: [
{ label: "Normal item" }
]
},
{ label: "Normal item #2" }
]
};
export const MyRadNavigationBar = <RadNav menu={menu} />
Custom Rendering
RadNav
has a few props for providing functions that can be used to render your custom components instead of the stock ones.
renderMobileMenu
:menu
: Menuselect
: Function(item | menu)- Note you'll need to manage your own state and only call
select
when you intend to select a leaf item or a current menu, not to visit a submenu.
- Note you'll need to manage your own state and only call
renderHeader
: Function(menu, select) => HeaderrenderItem
: Function(menu, select, index) => Item
renderDesktopDropdown
:menu
: Menuselect
: Function(item | menu)- Since Dropdowns are stateless,
select
is also to select a leaf item or root menu.
- Since Dropdowns are stateless,
renderHeader
: Function(menu, select) => HeaderrenderItem
: Function(menu, select, index) => Item
renderMobileHeader
:menu
: Menuselect
: Function(item | menu)
renderDesktopHeader
:menu
: Menuselect
: Function(item | menu)
renderMobileItem
:menu
: Menuselect
: Function(item | menu)index
: Number
renderDesktopItem
:menu
: Menuselect
: Function(item | menu)index
: Number
renderMobileClose
:menu
: Menuclose
: Function()
renderMobileOpen
:menu
: Menuopen
: Function()
Styling
TODO