Git Product home page Git Product logo

react-responsive-sidebar's Introduction

react-responsive-sidebar npm version

A simple and elegant responsive sidebar component for react

Sidebar SidebarItem

Getting Started

This component works best as the outer most visual component in your app. You may wrap it in data container components, but it is not suggested to nest it within other visual elements for the time being.

import React from 'react';
import { render } from 'react-dom';
import { Sidebar, SidebarItem } from 'react-responsive-sidebar';
import YourAppContent from 'path/to/your/app/content'

const items = [
  <SidebarItem>Dashboard</SidebarItem>,
  <SidebarItem>Profile</SidebarItem>,
  <SidebarItem>Settings</SidebarItem>,
];

render (
  <Sidebar content={items}>
    <YourAppContent />
  </Sidebar>
, document.findElementById("render-target"))

Sidebar

Property Type Default Description
background string #009688 background color of the sidebar
color string #fff text color for sidebar items
backdrop bool true show a backdrop when sidebar is opened from collapsed state
closeOnBackdropClick bool true closes the sidebar when the backdrop is clicked
width number 300 width of sidebar
breakPoint number 980 breakpoint where the sidebar collapses (px)
toggleIconSize number 28 size of the toggle icon (px)
toggleIconColor string background color of the icon that toggles the sidebar
content array n/a content to fill the sidebar with (SidebarItem, SidebarSelector)
onCollapse func n/a A function to call when the sidebar collapses/expands. Provides a boolean, true if collapsed, false if expanded.
onOpen func n/a A function to call when the sidebar is toggle. Provides a boolean, true of opened, false if closed.
onItemSelected func n/a A function to call when an item is selected. will provide selected items props.
closeOnItemSelect bool true Sets if the sidebar close when an item is selected
hoverHighlight string rgba(255,255,255,0.15) Sets hoverHighlight prop on each item, unless directly specified on the item
activeHightlight string rgba(255,255,255,0.2) Sets activeHightlight prop on each item, unless directly specified on the item

SidebarItem

Property Type Default Description
background string sidebar.background background color, inherited from sidebar if not set manually
color string white text and icon color
href string n/a where to go on click, react-router compatible but not required
leftIcon element n/a Icon used for the left side of the item. (react-icons is a great package for this)
rightIcon element n/a Icon used for the right side of the item. (react-icons is a great package for this)
textAlign string left alignment of the title within the item
hoverHighlight string rgba(255,255,255,0.15) Background color of the item when hovered over
activeHightlight string rgba(255,255,255,0.2) Background color of the item when in the active state (At its href)
onClick func n/a a function to call when the item is clicked

react-responsive-sidebar's People

Contributors

gregchamberlain avatar umpc avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.