1.0.3 • Published 3 years ago

react-multilevel-navbar v1.0.3

Weekly downloads
9
License
ISC
Repository
github
Last release
3 years ago

React Multilevel Navbar

A component that provides a nice-looking multilevel menu bar for your website. It is responsive and also navigable with the focus/tab key.

Check a live example!

Installation

npm i react-multilevel-navbar

import ReactMultiLevelNavbar from 'react-multilevel-navbar';

Props

These are the props you can pass to the component:

NameTypeDefaultRequired
modelobjectmodelyes
custom_widthstring100%no
custom_paddingstring1.5remno
custom_fontFamilystringRaleway, sans-serifno
mobile_breakpointnumber (in pixels)645no
custom_colorsobjectCustom Colorsno

Model

The taxonomy model must follow this structure:

const model = {

    ['Level 1'] : {
        ['Sublevel 1-1'] : '#',
        ['Sublevel 1-2'] : '#'
    },

    ['Level 2'] : {
        ['Sublevel 2-1']: {
            ['Sublevel 2-1-1']: '#'
        },
        ['Level 2-2'] : {
            ['Level 2-2-1'] : '#'
        }
    }
	//etc...
	
}

There is no limit in nesting levels

Custom colors

The custom_colors prop must be an object of strings, where you specify the property that you want to change. These are the default values:

props.custom_colors = {
	background_color: 'rgb(240, 238, 238)',
	expand_color: 'rgb(255, 190, 190)',
	hover_color: 'black',
	contrast_color: 'white'
}

You do not need to fill the entire object with all the properties, just set the desired ones.