react-sliding-sidemenu
v1.1.8
Published
Customisable Responsive sliding sidebar menu , can be easily intigrated within application.
Downloads
14
Maintainers
Readme
react-sliding-sidemenu
react sliding sidemenu is a fully customizable with zero dependancy, written in pure JS and CSS responsive sidebar menu. this will gives a quick access to menu links to navigate through different routes in application.
Installation
npm install react-sliding-sidemenu --save
customisable features
- color of the text inside the sidebar menu
- margin-top of the sidebar
- font style
- order of content inside sidebar (profile,description and links sections)
- upto 2 levels of sub links
- customisable expand icon style
- links will support react-router
- profile and description sections can be hidden if not required.
- full view of the profile pic on click.
Using react-sliding-sidemenu
import componnent from :- react-sliding-sidemenu_ in your component. pass props to the component with data and avaialbe props to customise and you are done.
import React from 'react'
import ReactDOM from 'react-dom'
import Sidebar from 'react-sliding-sidemenu'
class App extends React.Component {
render() {
return (
<div>
//call the Sidebar component with props
<Sidebar {...props}>
</div>
);
}
}
ReactDOM.render(
<App/>,
document.getElementById('root')
)
Available features from props
functions
onLinkItemClick(clickedLink)
this function can be passed as props to the component , which will be executed on click of the menu links. function will recieve an arguement which holds the details of the clicked link. Note to use above function pass href for that link as "#".At a time either href or onClick one of can be used.
dataForLinks sample object
href below indicates the navigation to be routed on click on the links.(same as href for anchor tag) **Note : ** all properties are case sensitive.
dataForLinks:
[
{
mainLink: "Main Link 1",
href: "pass the link",
subLinks: [
{
subLink: "Sub Link 1",
href: "pass the link",
childLinks: [
{
childLink: 'Child Link 1',
href: 'pass the link'
},
{
childLink: 'Child Link 2',
href: 'pass the link'
}
]
},
{
subLink: "Sub Link 2",
href: "pass the link",
childLinks: []
},
{
subLink: "SubLink 3",
href: "pass the link",
childLinks: []
}
]
},
{
mainLink: "Main Link 3",
href: "pass the link",
subLinks: []
}
]